end18 / psutil

Automatically exported from code.google.com/p/psutil
Other
0 stars 0 forks source link

Strange PID 0 exception behavior on Windows #22

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

>>> psutil.Process(0).kill()
>>> psutil.Process(2408).name
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python26\Lib\site-packages\psutil\psutil.py", line 54, in __init__
    if not pid_exists(pid):
  File "C:\Python26\Lib\site-packages\psutil\psutil.py", line 149, in
pid_exists

    return _platform_impl.pid_exists(pid)
  File "C:\Python26\Lib\site-packages\psutil\_psmswindows.py", line 29, in
pid_e
xists
    return pid in _psutil_mswindows.get_pid_list()
WindowsError: [Error 87] Parametro non corretto
>>>
>>> psutil.Process(2408).name
'xchat.exe'
>>>

It seems that psutil.Process(0).kill() fails internally and that its
exception is "cached" somehow and raised when we attempt to fetch
information from another process.

Original issue reported on code.google.com by billiej...@gmail.com on 23 Feb 2009 at 7:05

GoogleCodeExporter commented 9 years ago
Fixed in r148 - kill_process() was returning 0 instead of NULL so the exception 
was
only being set and not raised like it should have been.

Original comment by jlo...@gmail.com on 23 Feb 2009 at 8:31

GoogleCodeExporter commented 9 years ago

Original comment by billiej...@gmail.com on 24 Feb 2009 at 11:24

GoogleCodeExporter commented 9 years ago

Original comment by billiej...@gmail.com on 17 Mar 2009 at 3:31

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Updated csets after the SVN -> Mercurial migration:
r148 == revision 64bd6979d6be

Original comment by g.rodola on 2 Mar 2013 at 11:44