stanfordnlp / python-stanford-corenlp

Python interface to CoreNLP using a bidirectional server-client interface.
MIT License
516 stars 105 forks source link

how to set path and use python-stanford-corenlp while i use mac #18

Closed prigioni closed 5 years ago

prigioni commented 6 years ago

how to use

arunchaganty commented 6 years ago

Hello Prigioni, Could you be more specific about what the error you are facing? The README documentation provides an example of use: https://github.com/stanfordnlp/python-stanford-corenlp

prigioni commented 6 years ago

from stanfordcorenlp import StanfordCoreNLP nlp = StanfordCoreNLP(r'/Users/lqm/Desktop/stanford-corenlp-full-2018-01-31')

Traceback (most recent call last): File "/Applications/anaconda3/lib/python3.6/site-packages/psutil/_psosx.py", line 330, in wrapper return fun(self, *args, **kwargs) File "/Applications/anaconda3/lib/python3.6/site-packages/psutil/_psosx.py", line 515, 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/lqm/Desktop/python3/test_stanfordcorenlp.py", line 9, in nlp = StanfordCoreNLP(r'/Users/lqm/Desktop/stanford-corenlp-full-2018-01-31') File "/Users/lqm/.local/lib/python3.6/site-packages/stanfordcorenlp/corenlp.py", line 79, in init if port_candidate not in [conn.laddr[1] for conn in psutil.net_connections()]: File "/Applications/anaconda3/lib/python3.6/site-packages/psutil/init.py", line 2111, in net_connections return _psplatform.net_connections(kind) File "/Applications/anaconda3/lib/python3.6/site-packages/psutil/_psosx.py", line 249, in net_connections cons = Process(pid).connections(kind) File "/Applications/anaconda3/lib/python3.6/site-packages/psutil/_psosx.py", line 335, in wrapper raise AccessDenied(self.pid, self._name) psutil._exceptions.AccessDenied: psutil.AccessDenied (pid=3372)

why?

prigioni commented 6 years ago

when I sudo python, it done

Fridgi commented 6 years ago

You can insert this line os.environ['CORENLP_HOME'] = "/Users/lqm/Desktop/stanford-corenlp-full-2018-01-31"