fhamborg / Giveme5W1H

Extraction of the journalistic five W and one H questions (5W1H) from news articles: who did what, when, where, why, and how?
Apache License 2.0
505 stars 87 forks source link

Having trouble running examples/possible geopy issue #61

Open anna-02 opened 3 years ago

anna-02 commented 3 years ago

I am getting the following error message when running parse_single_from_code.py:

Traceback (most recent call last): File "/Users/annaablove/Desktop/py_test/who.py", line 53, in extractor = MasterExtractor() File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/Giveme5W1H/extractor/extractor.py", line 60, in init environment_extractor.EnvironmentExtractor(), File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/Giveme5W1H/extractor/extractors/environment_extractor.py", line 55, in init self.geocoder = Nominatim(domain=host, timeout=8) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/geopy/geocoders/nominatim.py", line 103, in init Nominatim(user_agent="my-application") File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/geopy/geocoders/nominatim.py", line 103, in init Nominatim(user_agent="my-application") File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/geopy/geocoders/nominatim.py", line 103, in init Nominatim(user_agent="my-application") [Previous line repeated 487 more times] File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/geopy/geocoders/nominatim.py", line 92, in init super().init( File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/geopy/geocoders/base.py", line 242, in init self.adapter = adapter_factory( File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/geopy/adapters.py", line 335, in init self.session = requests.Session() File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/requests/sessions.py", line 367, in init self.headers = default_headers() File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/requests/utils.py", line 821, in default_headers return CaseInsensitiveDict({ File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/requests/structures.py", line 46, in init self.update(data, **kwargs) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/_collections_abc.py", line 854, in update if isinstance(other, Mapping): File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/abc.py", line 98, in instancecheck return _abc_instancecheck(cls, instance) RecursionError: maximum recursion depth exceeded in comparison

I think it has something to do with Nominatim.py, but I am inexperienced with geopy and am having trouble isolating the problem. Any help would be appreciated, thanks!

ajyl commented 3 years ago

TL;DR you can probably do

pip3 uninstall geopy
pip3 install geopy==1.13.0

For repo authors, I think setup.py needs to be updated - I'm seeing that setup.py will install geopy>=1.11.0, which gives me 2.1.0. However, it seems like geopy versions > 2.0 introduces breaking changes. I saw that in requirements.txt that geopy==1.13.0 is specified. I think setup.py needs to be updated accordingly.