You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What steps will reproduce the problem?
This code generates AccessDenied exceptions for all operations (except getting
the PID) on processes not owned by my user in W7 64bits, python 2.7.3 64bits,
psutil 0.4.1 64bits, even if i have admin rights and the python process is elevated.
import psutil
import logging
logging.basicConfig()
log = logging.getLogger(__name__)
for p in psutil.process_iter():
if p.pid == 0:
continue
process_attributes = list()
for attribute in ['username', 'pid', 'nice', 'exe']:
try:
process_attributes.append(getattr(p, attribute))
except (psutil.AccessDenied) as err:
log.error('{}: Trying to access {} of
{}'.format(err.__class__.__name__,
attribute, err))
print process_attributes
Output is something like this:
ERROR:__main__:AccessDenied: Trying to access username of (pid=1636)
ERROR:__main__:AccessDenied: Trying to access nice of (pid=1636)
ERROR:__main__:AccessDenied: Trying to access exe of (pid=1636)
[1636]
ERROR:__main__:AccessDenied: Trying to access username of (pid=2556)
ERROR:__main__:AccessDenied: Trying to access nice of (pid=2556)
ERROR:__main__:AccessDenied: Trying to access exe of (pid=2556)
[2556]
ERROR:__main__:AccessDenied: Trying to access username of (pid=1548)
ERROR:__main__:AccessDenied: Trying to access nice of (pid=1548)
ERROR:__main__:AccessDenied: Trying to access exe of (pid=1548)
[1548]
['MYUSER', 4264, 32, 'C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe']
ERROR:__main__:AccessDenied: Trying to access username of (pid=3260)
ERROR:__main__:AccessDenied: Trying to access nice of (pid=3260)
ERROR:__main__:AccessDenied: Trying to access exe of (pid=3260)
[3260]
ERROR:__main__:AccessDenied: Trying to access username of (pid=4752)
ERROR:__main__:AccessDenied: Trying to access nice of (pid=4752)
ERROR:__main__:AccessDenied: Trying to access exe of (pid=4752)
[4752]
['MYUSER', 5020, 32, 'C:\\Program Files (x86)\\Mozilla
Thunderbird\\thunderbird.exe']
['MYUSER', 4796, 32, 'C:\\Program Files (x86)\\GNU\\GnuPG\\gpg-agent.exe']
ERROR:__main__:AccessDenied: Trying to access username of (pid=328)
ERROR:__main__:AccessDenied: Trying to access nice of (pid=328)
ERROR:__main__:AccessDenied: Trying to access exe of (pid=328)
[328]
['MYUSER', 4436, 32, 'C:\\Program Files (x86)\\Mozilla
Thunderbird\\plugin-container.exe']
['MYUSER', 4492, 32, 'C:\\Python27\\Scripts\\ipython.exe']
ERROR:__main__:AccessDenied: Trying to access exe of (pid=5948)
['MYUSER', 5948, 32]
['MYUSER', 5176, 32, 'C:\\Python27\\python.exe']
['MYUSER', 4676, 128, 'C:\\Program Files\\Process Hacker 2\\ProcessHacker.exe']
['MYUSER', 5100, 32, 'C:\\Windows\\system32\\cmd.exe']
ERROR:__main__:AccessDenied: Trying to access exe of (pid=5660)
['MYUSER', 5660, 32]
['MYUSER', 5696, 32, 'C:\\Python27\\python.exe']
['MYUSER', 2852, 32, 'C:\\Python27\\python.exe']
I got curious what process 5660 was...
'\??\C:\Windows\system32\conhost.exe
"-819514783406431421117177328-3794250371789057852-943298914-27174460378563238 '
That's the commandline ProcessHacker got.
What is the expected output?
Information about each process in the system, like ProcessHacker do when i
elevate it.
What do you see instead?
No information except PID, like ProcessHacker would do when it isn't elevated.
What version of psutil are you using? What Python version?
python 2.7.3 64bits, psutil 0.4.1 64bits
On what operating system? Is it 32bit or 64bit version?
W7 64bits
Yes, I'm aware of this and I don't know any workaround.
AFAIK, process hacker is able to determine those information because it is
installed as a driver or something like that, something which shouldn't be
easily suitable for a Python module.
From kurzedme...@gmail.com on June 11, 2012 22:46:39
Original issue: http://code.google.com/p/psutil/issues/detail?id=280
The text was updated successfully, but these errors were encountered: