Python Forum
Countryinfo package charmap error
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Countryinfo package charmap error
#7
I think you have misunderstand.
File "...\site-packages\countryinfo\countryinfo.py"
This should point to your root python installation,i just use ...\site-packages\countryinfo to point the file.
... should be where your Python 3.7 is installed.

Here with change to line 30 done.
C:\Users\Tom
λ python
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:06:47) [MSC v.1914 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from countryinfo import CountryInfo
>>>
>>> country = CountryInfo('France')
>>> country.capital()
'Paris'
>>> exit()
Now i remove encoding='utf-8' from line 30.
C:\Users\Tom
λ python
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:06:47) [MSC v.1914 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from countryinfo import CountryInfo
>>>
>>> country = CountryInfo('France')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\python37\lib\site-packages\countryinfo\countryinfo.py", line 30, in __init__
    country_info = json.load(open(file_path))
  File "C:\python37\lib\json\__init__.py", line 293, in load
    return loads(fp.read(),
  File "C:\python37\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>
You see it point to my python installation File "C:\python37\lib\site-packages\countryinfo\countryinfo.py"
Also i made change to countryinfo.py in this location.
Reply


Messages In This Thread
Countryinfo package charmap error - by mkaru - Sep-14-2018, 09:15 AM
RE: Countryinfo package charmap error - by snippsat - Sep-14-2018, 11:37 AM
RE: Countryinfo package charmap error - by mkaru - Sep-16-2018, 09:00 AM
RE: Countryinfo package charmap error - by snippsat - Sep-16-2018, 10:14 AM
RE: Countryinfo package charmap error - by mkaru - Sep-16-2018, 02:28 PM
RE: Countryinfo package charmap error - by snippsat - Sep-16-2018, 02:58 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  qpython package error Creepy 5 1,120 Apr-19-2024, 10:35 AM
Last Post: masonsbore
  UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 34: character Melcu54 7 18,948 Sep-26-2022, 10:09 AM
Last Post: Melcu54
  countryinfo package error MarcusAurelius 4 2,838 Mar-20-2021, 05:42 PM
Last Post: deanhystad
  error with netcdf4 package damdam 0 1,831 Nov-18-2020, 06:44 PM
Last Post: damdam
  'charmap' codec louis216 4 20,181 Jun-30-2020, 06:25 AM
Last Post: louis216
  Importing module from a package results in import error goghvv 2 2,392 Mar-27-2020, 07:13 PM
Last Post: goghvv
  Beginner - simple package installation error mefeng2008 0 1,725 Mar-13-2020, 09:17 AM
Last Post: mefeng2008
  Error importing package julio2000 3 3,769 Jan-26-2020, 06:15 PM
Last Post: buran
  Error in importing package in pycharm fullstop 0 2,346 Dec-12-2019, 04:03 PM
Last Post: fullstop
  error using geoGen package from GITHUB hknarahari 4 3,273 Sep-17-2019, 06:59 AM
Last Post: buran

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020