Re: Killing process
- From: Peter Hansen <peter@xxxxxxxxxxx>
- Date: Fri, 29 Apr 2005 21:29:02 -0400
Harlin Seritt wrote:
[...]I am using os.getpid() to get the pid value for a script running. I store that value (as a string) to a file. Later when I try to kill that pid (i pull this from the file as a string value) I get errors.
File "vngconsole.py", line 27, in StopVngSvc
win32api.TerminateProcess(int(pid), 0)
error: (6, 'TerminateProcess', 'The handle is invalid.')
I believe the problem is you are assuming TerminateProcess() takes a PID, when in fact it takes a "handle". See this recipe for some hints: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/347462
and http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/createprocess.asp
to learn more about the key function you're missing.
-Peter .
- Follow-Ups:
- Re: Killing process
- From: Harlin Seritt
- Re: Killing process
- References:
- Killing process
- From: Harlin Seritt
- Killing process
- Prev by Date: Re: Killing process
- Next by Date: Re: Python Challenge ahead [NEW] for riddle lovers
- Previous by thread: Re: Killing process
- Next by thread: Re: Killing process
- Index(es):
Relevant Pages
|