countryinfo icon indicating copy to clipboard operation
countryinfo copied to clipboard

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

Open CPapadim opened this issue 5 years ago • 3 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.

CPapadim avatar Jul 29 '19 23:07 CPapadim

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

ryanakuhl avatar Jan 07 '20 21:01 ryanakuhl

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>

aster94 avatar Mar 08 '20 14:03 aster94

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

emorell96 avatar Mar 24 '20 16:03 emorell96