reverse_geocode icon indicating copy to clipboard operation
reverse_geocode copied to clipboard

UnicodeDecodeError on python3.6

Open kirimaks opened this issue 4 years ago • 3 comments

Hi, I'm getting UnicodeDecodeError on python3.6:

>>> import reverse_geocode
>>> coordinates = (-37.81, 144.96), (31.76, 35.21)
>>> reverse_geocode.search(coordinates)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.6/dist-packages/reverse_geocode/__init__.py", line 121, in search
    gd = GeocodeData()
  File "/usr/local/lib/python3.6/dist-packages/reverse_geocode/__init__.py", line 25, in getinstance
    instances[cls] = cls()
  File "/usr/local/lib/python3.6/dist-packages/reverse_geocode/__init__.py", line 34, in __init__
    coordinates, self.locations = self.extract(rel_path(geocode_filename))
  File "/usr/local/lib/python3.6/dist-packages/reverse_geocode/__init__.py", line 100, in extract
    for latitude, longitude, country_code, city in rows:
  File "/usr/lib/python3.6/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 60: ordinal not in range(128)

kirimaks avatar Oct 23 '20 16:10 kirimaks

Moved to python3.7 it fixed the problem.

kirimaks avatar Oct 24 '20 15:10 kirimaks

strange - I was not aware 3.6 & 3.7 handle unicode differently

richardpenman avatar Oct 28 '20 01:10 richardpenman

I facing the same issue in python 3.9.1

akki401 avatar Mar 06 '24 07:03 akki401

Am unable to reproduce. Tested again in 3.11 and works.

richardpenman avatar Jun 06 '24 22:06 richardpenman

Perhaps was a Windows issue. Current repo explicitly sets encoding. If this does not fix the error please reopen with more details about your system.

richardpenman avatar Jun 06 '24 22:06 richardpenman