Using the provided example code (below) I get an error when it tries to create an instance of Gazetteer.
Code:
from gazetteer import Gazetteer # import the library
gz = Gazetteer() # gazetteer instance
coordinates = [
(-74.0060, 40.7128),
(76.2673, 9.9312),
] # list of tuples, in order longitude,latitude
for data in gz.search(coordinates): # gz.search() returns a generator
print(data) # GeocoderResultBaseModel
Error:
Exception has occurred: UnicodeDecodeError
'charmap' codec can't decode byte 0x90 in position 1475: character maps to
Traceback:
File "d:\Projects\geoguessr\src_exploration\test_gazetteer.py", line 3, in
gz = Gazetteer() # gazetteer instance
File "C:\Users\james\AppData\Local\Programs\Python\Python314\Lib\site-packages\gazetteer\reverse_geocode.py", line 65, in getinstance
instances[cls] = cls(**kwargs)
~~~^^^^^^^^^^
File "C:\Users\james\AppData\Local\Programs\Python\Python314\Lib\site-packages\gazetteer\reverse_geocode.py", line 85, in init
coordinates, self.locations = self._load()
~~~~~~~~~~^^
File "C:\Users\james\AppData\Local\Programs\Python\Python314\Lib\site-packages\gazetteer\reverse_geocode.py", line 103, in _load
header = stream_reader.fieldnames
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\james\AppData\Local\Programs\Python\Python314\Lib\csv.py", line 163, in fieldnames
self._fieldnames = next(self.reader)
~~~~^^^^^^^^^^^^^
File "C:\Users\james\AppData\Local\Programs\Python\Python314\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 0x90 in position 1475: character maps to
I've just installed a fresh copy of python 3.14.2 and Gazetteer using pip install python-gazetteer as per the readme. I'm running on Windows 11 using VSCode.
Using the provided example code (below) I get an error when it tries to create an instance of Gazetteer.
Code:
Error:
Traceback:
I've just installed a fresh copy of python 3.14.2 and Gazetteer using
pip install python-gazetteeras per the readme. I'm running on Windows 11 using VSCode.