-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WINDOWS] Uncaught exception in exe() method ? #1501
Comments
Mmmm... it seems there are different things at play here. This one:
If the PID did not exist at this moment in time then we should convert that (WinError 1168) into NoSuchProcess. Can you reproduce this case reliably (and verify)? As for the second exception (AccessDenied) that is expected and "fine" unless it breaks |
Yes, it can be reproduced reliably : PID 1732 is "Memory Compression", a "pseudo" process maintained by windows 10 (another one is "Registry" on windows 10) :
Note the first exception raised :
As for the second one, from what I understand :
==> |
Oh! I had no idea such a process existed. That raises different questions. Are import psutil
p = psutil.Process()
for name in psutil._as_dict_attrnames:
meth = getattr(p, name)
if callable(meth):
try:
meth()
except psutil.Error:
pass
except Exception as err:
print(name)
print(err)
Definitively. Any method raising anything else other than |
Apparently yes, only
(last exception is in |
Do you know how I can create such a process myself (I'd like to try it out - am also curious what ProcessHacker does about this). If only |
those processes (Registry and/or Memory Compression) are out of the box on a windows 10 system In process explorer (from sysinternals) : Memory Compression : same |
I have those processes (win 10) but they work fine for me. I suppose if you run tests you bump into a failure right? (that's good) If you're up for it feel free to provide a PR, else I will do it sometime later. |
Try with an elevated command prompt (where you can actually open a handle on the process but the API call fail). I think it's working fine with a standard user (with no admin rights) |
Hi, I encountered the same error: raceback (most recent call last): I just want to ask about the resolution or workaround about this. Thank you |
The exe() method raises an exception (uncaught/unhandled exception type?) when querying special processes
python launched as admin (in an elevated CMD prompt) on windows 10, getting info on special process
"Memory Compression"
(pid 1956)This fails the same way on psutil >= 5.6.0 (probably due to using
QueryFullProcessImageNameW
now or not catching the right error code)It "works" (doesn't crash) on 5.5.1
This kind of code is broken because of this exception as getting the 'exe' field crashes the whole function call:
Not sure if this is expected or if the exception caught is currently unhandled
As a normal user (not admin), getting the exe() field of "normal" process which we don't have the rights to get produces the following (we get the
psutil.AccessDenied
exception):The text was updated successfully, but these errors were encountered: