Lynten / stanford-corenlp

Python wrapper for Stanford CoreNLP.
MIT License
919 stars 200 forks source link

Got permission error when running StanfordCoreNLP #88

Open Freakwill opened 4 years ago

Freakwill commented 4 years ago

Got the following error when running StanfordCoreNLP(r'/usr/local/Cellar/stanford-corenlp/3.9.1/libexec', lang='zh'). I know that it can be dismissed via sudo command in shell (have to input the passward), but it is convenient. I just run it ordinarily.

$ java -version 
openjdk version "13" 2019-09-17
OpenJDK Runtime Environment (build 13+33)
OpenJDK 64-Bit Server VM (build 13+33, mixed mode, sharing)

Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/psutil/_psosx.py", line 339, in wrapper return fun(self, *args, **kwargs) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/psutil/_psosx.py", line 528, in connections rawlist = cext.proc_connections(self.pid, families, types) PermissionError: [Errno 1] Operation not permitted

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/william/Programming/Python/mytest/nlptest/corenlptest.py", line 8, in with StanfordCoreNLP(r'/usr/local/Cellar/stanford-corenlp/3.9.1/libexec', lang='zh') as nlp: File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/stanfordcorenlp/corenlp.py", line 79, in init if port_candidate not in [conn.laddr[1] for conn in psutil.net_connections()]: File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/psutil/init.py", line 2263, in net_connections return _psplatform.net_connections(kind) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/psutil/_psosx.py", line 252, in net_connections cons = Process(pid).connections(kind) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/psutil/_psosx.py", line 344, in wrapper raise AccessDenied(self.pid, self._name) psutil.AccessDenied: psutil.AccessDenied (pid=26702)

nate-bush commented 4 years ago

Please see related issue for solution: https://github.com/Lynten/stanford-corenlp/issues/26