porimol / countryinfo

A python module for returning data about countries, ISO info and states/provinces within them.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

'ascii' codec can't decode byte 0xe6 in position 75: ordinal not in range(128)

CPapadim opened this issue · comments

I get the error in the title when calling x = CountryInfo()

I'm able to fix this by adding 'rb' to the open() statement that reads the country json files.

commented

Thanks, adding it to line 30 of countryinfo.py worked for me.

same error here on python 3.7.3 installing the lib from pip

runfile('C:/Users/vincenzo/.spyder-py3/temp.py', wdir='C:/Users/vincenzo/.spyder-py3')
Traceback (most recent call last):

  File "C:\Users\vincenzo\.spyder-py3\temp.py", line 11, in <module>
    country = CountryInfo('Italy')

  File "C:\Users\vincenzo\Miniconda3\lib\site-packages\countryinfo\countryinfo.py", line 30, in __init__
    country_info = json.load(open(file_path))

  File "C:\Users\vincenzo\Miniconda3\lib\json\__init__.py", line 293, in load
    return loads(fp.read(),

  File "C:\Users\vincenzo\Miniconda3\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 49: character maps to <undefined>
commented

Same issue here. UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 49: character maps to