Re: Killing process



TerminateProcess takes a process handle, not a pid.
win32api.OpenProcess will give you a handle.

Roger

"Harlin Seritt" <harlinseritt@xxxxxxxxx> wrote in message
news:1114823011.063614.27150@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>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.
>
> Using the following lines I get the subsequent error.
>
> (pid is a string value)
> win32api.TerminateProcess(int(pid), 0)
>
> OR
>
> ctypes.windll.kernel32.TerminateProcess(int(pid), 0)
>
> Errors:
>
> Exception in Tkinter callback
> Traceback (most recent call last):
> File "C:\Python23\lib\lib-tk\Tkinter.py", line 1345, i
> return self.func(*args)
> File "vngconsole.py", line 27, in StopVngSvc
> win32api.TerminateProcess(int(pid), 0)
> error: (6, 'TerminateProcess', 'The handle is invalid.')
>
> How exactly do I kill a pid using a string value?
>




----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---
.



Relevant Pages

  • Re: help with aix script required
    ... PIB nnn is already connected (pid nnnnn) ... to extract the pid and then execute kill (pid ... before retrying the d3 -n -dcdon command. ... feed the string to the above without the 'echo'. ...
    (comp.unix.aix)
  • Re: Cant get IWbemConfigureRefresher::AddObjectByPath to work with Win32_PerfRawData_PerfProc_Proces
    ... OK following your suggestion I've formatted the string, wstr, as ... where pid is the processID that I'm interested in. ... But I want to call AddObjectByPath ... Manbinder Pal Singh wrote: ...
    (microsoft.public.win32.programmer.wmi)
  • Re: Cant get IWbemConfigureRefresher::AddObjectByPath to work with Win32_PerfRawData_PerfProc_Proces
    ... OK following your suggestion I've formatted the string, wstr, in the ... code snippet above as ... where pid is the processID that I'm interested in. ... Manbinder Pal Singh wrote: ...
    (microsoft.public.win32.programmer.wmi)
  • Re: help with aix script required
    ... PIB nnn is already connected (pid nnnnn) ... to extract the pid and then execute kill (pid ... before retrying the d3 -n -dcdon command. ... feed the string to the above without the 'echo'. ...
    (comp.unix.aix)
  • Killing process
    ... I am using os.getpid() to get the pid value for a script running. ... store that value to a file. ... pid (i pull this from the file as a string value) I get errors. ... How exactly do I kill a pid using a string value? ...
    (comp.lang.python)