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?
1. psutil.Process(4).exe (inadvertantly from calling as_dict())
Drilled down to the lowest call:
>>> _psutil_mswindows.get_process_exe(4)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
WindowsError: [Error 5] Access is denied
>>> _psutil_mswindows.get_process_exe(4)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
WindowsError: [Error 87] The parameter is incorrect
What is the expected output?
psutil._error.AccessDenied: (pid=4)
What do you see instead?
WindowsError [Error 87] The parameter is incorrect
What version of psutil are you using? What Python version?
psutil tip (02ce4f7587ef)
Python 2.7.5
On what operating system? Is it 32bit or 64bit version?
Win7SP1 x86
WinXPSP3 x86
Please provide any additional information below.
This is because of the inconsistent errno returned by GetProcessImageFileName.
We can't control what Windows returns to us but we can try to make it
consistent to the end user.
[proc.as_dict(ad_value="ACCESS DENIED") for proc in psutil.process_iter()]
works gracefully on Win7. On WinXP, the exception bubbles up and breaks execution.
In _psmswindows.py:wrap_exceptions a check is made to see if the WindowsError
errno is in the a predefined ACCESS_DENIED_SET. In the case of WinXP, the
error raised is ERROR_INVALID_PARAMETER which is not in this set.
I'm not sure when the errno changes between Windows versions, I only have WinXP
and Win7 to test with.
From [email protected] on July 28, 2013 18:10:38
Original issue: http://code.google.com/p/psutil/issues/detail?id=414
The text was updated successfully, but these errors were encountered: