Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decoding error when running on windows (in console) #4

Open
e-ehrhardt opened this issue Aug 9, 2020 · 0 comments
Open

Decoding error when running on windows (in console) #4

e-ehrhardt opened this issue Aug 9, 2020 · 0 comments

Comments

@e-ehrhardt
Copy link

e-ehrhardt commented Aug 9, 2020

from pysblgnt import morphgnt_rows
for row in morphgnt_rows(1): print(row)

...
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\ProgramData\Anaconda3\envs\greek\lib\site-packages\pysblgnt\__init__.py", line 29, in morphgnt_rows
    for line in f:
  File "C:\ProgramData\Anaconda3\envs\greek\lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 275: character maps to <undefined>

As far as I can tell, this is a Windows thing, where by default utf-8 is not used with open. When importing this as a module then, it's not possible to open the files correctly.
Reference: http://www.macfreek.nl/memory/Encoding_of_Python_stdout (EDIT: Ok maybe that's not the appropriate link since that talks about writing out for files rather than reading them in, but it's the same thing going on. Line 28 of __init.py with open(filename) as f: fails for me because utf-8 encoding isn't specified.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant