countryinfo
countryinfo copied to clipboard
'ascii' codec can't decode byte 0xe6 in position 75: ordinal not in range(128)
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.
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>
Same issue here. UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 49: character maps to