Psutil.accessdenied When Using Stanfordcorenlp In Pycharm?
Solution 1:
Unfortunately, if you look at the psutil project in _psosx.py, under net_connections, line 243 says..
Note: on macOS this will fail with AccessDenied unless the process is owned by root.
That means that you'll need to run as root by doing something like sudo pycharm.sh.
If you don't want to run your entire IDE as root, there's a few examples on SO on how you can run a specific script with super-user privileges. For instance see Debugging in pyCharm with sudo privileges.
Solution 2:
This problem seems to be specific to Mac OS X which would not allow Python to check the current port.
Comment this portion of code of corenlp.py file:
if self.port isNone:
for port_candidate inrange(9000, 65535):
if port_candidate notin [conn.laddr[1] for conn in psutil.net_connections()]:
self.port = port_candidate
breakif self.port in [conn.laddr[1] for conn in psutil.net_connections()]:
raise IOError('Port ' + str(self.port) + ' is already in use.')
Replace by this line:
self.port = 9999Source: https://github.com/Lynten/stanford-corenlp/issues/26#issuecomment-445507811
Another solution is to run StanfordCoreNLP with a sudo command line.
Post a Comment for "Psutil.accessdenied When Using Stanfordcorenlp In Pycharm?"