Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Fix UnicodeDecodeError #16
I'm currently getting the following error on my Windows machine:
>>> import ety Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Users\Alex\repos\ety-python\ety\__init__.py", line 10, in <module> data.load() File "C:\Users\Alex\repos\ety-python\ety\data.py", line 45, in load load_country_codes() File "C:\Users\Alex\repos\ety-python\ety\data.py", line 35, in load_country_codes countries_json = json.load(f) File "C:\Python36\Lib\json\__init__.py", line 296, in load return loads(fp.read(), File "C:\Users\Alex\.virtualenvs\ety-python-_lx5rZzb\lib\encodings\cp1252.py", line 23, in decode return codecs.charmap_decode(input,self.errors,decoding_table) UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 8732: character maps to <undefined>
This PR should fix this by specifying the encoding.
Just for reference: everything was working fine on my Linux machine. I did some digging because I was curious as to why.
And yup, on the windows machine:
>>> import locale >>> locale.getpreferredencoding() 'cp1252'