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
As of right now on Windows we determine the process executable path by guessing
it from the cmdline:
https://code.google.com/p/psutil/source/browse/tags/release-0.5.0/psutil/_psmswindows.py#167
https://code.google.com/p/psutil/source/browse/tags/release-0.5.0/psutil/__init__.py#224
This is unfortunate because cmdline raises AccessDenied for almost any process
except the ones owned by the current user.
In r1394 I used GetProcessImageFileName() which fails less often and avoids the
cmdline guessing.
Example script:
for p in sorted(psutil.process_iter(), key=lambda x: x.pid):
print p.pid,
try:
print p.exe
except psutil.AccessDenied, err:
print 'AD'
===============================
Before
===============================
0 AD
4 AD
268 AD
300 AD
356 AD
392 AD
404 AD
432 AD
488 AD
504 AD
512 AD
540 C:\Users\user\AppData\Local\Google\Chrome\Application\chrome.exe
556 AD
616 AD
672 AD
700 AD
756 AD
852 AD
856 AD
876 AD
936 AD
1032 AD
1224 C:\Users\user\AppData\Local\Google\Chrome\Application\chrome.exe
1268 AD
1280 AD
1452 C:\Users\user\AppData\Local\Google\Chrome\Application\chrome.exe
1552 AD
1584 AD
1760 AD
1836 AD
1860 AD
1984 AD
2004 AD
2144 C:\Users\user\AppData\Local\Google\Chrome\Application\chrome.exe
2340 C:\Python27\python.exe
2808 C:\Users\user\AppData\Local\Google\Chrome\Application\chrome.exe
3012 AD
===============================
Now
===============================
0 AD
4 AD
268 AD
300 AD
356 AD
392 AD
404 AD
432 AD
488 AD
504 AD
512 AD
540 C:\Users\user\AppData\Local\Google\Chrome\Application\chrome.exe
556 AD
616 AD
672 AD
700 AD
756 AD
852 C:\Windows\System32\conhost.exe
856 C:\Windows\System32\cmd.exe
876 AD
936 AD
1032 AD
1224 C:\Users\user\AppData\Local\Google\Chrome\Application\chrome.exe
1268 C:\Program Files\TortoiseSVN\bin\TSVNCache.exe
1280 AD
1452 C:\Users\user\AppData\Local\Google\Chrome\Application\chrome.exe
1456 C:\Windows\System32\dllhost.exe
1468 C:\Python27\python.exe
1552 AD
1584 AD
1760 C:\Windows\System32\taskhost.exe
1836 C:\Windows\System32\dwm.exe
1860 C:\Windows\explorer.exe
1984 C:\Windows\System32\VBoxTray.exe
2004 C:\Program Files\TortoiseHg\TortoiseHgOverlayServer.exe
2144 C:\Users\user\AppData\Local\Google\Chrome\Application\chrome.exe
2808 C:\Users\user\AppData\Local\Google\Chrome\Application\chrome.exe
3012 C:\Users\user\Desktop\procexp64.exe
From g.rodola on June 29, 2012 05:31:20
Original issue: http://code.google.com/p/psutil/issues/detail?id=293
The text was updated successfully, but these errors were encountered: