New issue 254 by g.willgo...@telluricresearch.com: get_cpu_times(), access
denied error on OSX
http://code.google.com/p/psutil/issues/detail?id=254
>>> p = psutil.Process(52799)
>>> p.cmdline
['/Applications/Utilities/Terminal.app/Contents/MacOS/Terminal', '-psn_0_33234864']
>>> p.get_cpu_times()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "psutil/__init__.py", line 364, in get_cpu_times
return self._platform_impl.get_cpu_times()
File "psutil/_psosx.py", line 97, in wrapper
raise AccessDenied(self.pid, self._process_name)
psutil.error.AccessDenied: (pid=52799, name='Terminal')
>>> p.get_memory_info()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "psutil/__init__.py", line 375, in get_memory_info
return self._platform_impl.get_memory_info()
File "psutil/_psosx.py", line 97, in wrapper
raise AccessDenied(self.pid, self._process_name)
psutil.error.AccessDenied: (pid=52799, name='Terminal')
What version of psutil are you using? What Python version?
psutil v0.4.1
python 2.7.2
On what operating system? Is it 32bit or 64bit version?
OSX 10.6.8
I've tried for for a few different pids and seems to be common to all ...
so its not 'Terminal' specific thing.
Comment #1 on issue 254 by jlo...@gmail.com: get_cpu_times(), access denied
Are you running as root?
You have to run your Python script as root in order to use psutil functions
that read information from another process. This is part of the security
model on OS X which does not allow one process to read from another process
even if they are owned by the same user. Run your script as 'sudo python
myscript.py' for example, and you should be able to get CPU information for
other processes.