FileNotFoundError: While running giveme5w1h-rest example.
To Reproduce :
$ giveme5w1h-corenlp #starting corenlp
copy the example code from README file of the reposetory under the title "Use within your own code (as a library)"
from Giveme5W1H.extractor.document import Document
from Giveme5W1H.extractor.extractor import MasterExtractor
extractor = MasterExtractor()
doc = Document.from_text(text, date_publish)
# or: doc = Document(title, lead, text, date_publish)
doc = extractor.parse(doc)
top_who_answer = doc.get_top_answer('who').get_parts_as_text()
print(top_who_answer)
input data such as text, date_publish were taken from https://github.com/fhamborg/Giveme5W1H/blob/master/Giveme5W1H/examples/extracting/parse_documents.py
Now run the python file containing the above code (I used jupyter notebook)
ERROR:
Exception in thread Thread-10:
Traceback (most recent call last):
File "/usr/local/Cellar/python/3.6.5_1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/usr/local/lib/python3.6/site-packages/Giveme5W1H/extractor/extractor.py", line 20, in run
extractor.process(document)
File "/usr/local/lib/python3.6/site-packages/Giveme5W1H/extractor/extractors/abs_extractor.py", line 40, in process
self._extract_candidates(document)
File "/usr/local/lib/python3.6/site-packages/Giveme5W1H/extractor/extractors/environment_extractor.py", line 147, in _extract_candidates
self._cache_nominatim.cache(location_string, location)
File "/usr/local/lib/python3.6/site-packages/Giveme5W1H/extractor/tools/key_value_cache.py", line 58, in cache
self.persist()
File "/usr/local/lib/python3.6/site-packages/Giveme5W1H/extractor/tools/key_value_cache.py", line 43, in persist
with open(self._cache_path, 'wb') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib/python3.6/site-packages/Giveme5W1H/examples/caches/Nominatim.prickle'
OS : MacOs 10.14: Python Version : 3.6 Giveme5W1H : 1.0.13 Stanford CoreNLP :stanford-corenlp-full-2018-10-05
I was able to run the code by copping the caches folder from the repository Giveme5W1H/examples to my local package folder. I also changed the name of the file inside the caches folder by removing the first "_" character.
I was able to run the code by copping the caches folder from the repository Giveme5W1H.examples to my local package folder. I also changed the name of the file inside the caches folder by removing the first "_" character.
I had the same issue and fixed it the same way you did.
it seems that when using anaconda or jupyter notebook there are issue with file access (also see #29 )
If wget is not pre installed in macOS it cause problem while installing.
no, the issue at hand is that Giveme5W1H is about to create the file Nominatim.prickle but can't, and hence has no writing permission at that location (/usr/local/lib/python3.6/site-packages/Giveme5W1H/examples/caches/). which is because everything under /usr can only be accessed with writing permission by root but on a regular macOS installation not by a regular user.
@abhimanyuNitSri how exactly did you install Giveme5W1H?
@abhimanyuNitSri how exactly did you install Giveme5W1H?
- I manually installed wget
- Follow the installing instruction from README file
- copied the caches folder from the repository Giveme5W1H/examples to my local package folder.
- changed the name of the file inside the caches folder by removing the first "_" character.
If someone have attempted installing before and failed then this might not work as few files are created while installing and are not removed when uninstalling Giveme5W1H. And those previously create file create problem while reinstalling
So for that problem user have to manual delete folders(which where created while initial installing process : "Giveme5W1H" and "giveme5w1h-1.0.13.dist-info") from there /usr/local/lib/python3.6/site-packages/ and then repeat the above steps.
@abhimanyuNitSri how exactly did you install Giveme5W1H? @fhamborg Sir, I want to work and contribute to open source libraries so please let me know, if I can be of some help to you.
I had the same problem, installing via pypi. Copying in the caches dir by hand fixed it for me as well.
I had the same problem, installing via pypi. Copying in the
cachesdir by hand fixed it for me as well.
which operating system are you using.
I'm using macOS 10.14.2. Python3 installed with pyenv. Giveme5W1H installed with PyPi.
I was able to run the code by copping the caches folder from the repository Giveme5W1H/examples to my local package folder. I also changed the name of the file inside the caches folder by removing the first "_" character.
Same issue. Installed using pip. And fixed it the same way you did.
Same issue here. Ubuntu16, python3.7.