[python-win32] Maybe the wrong newsgroup to ask ?

Stef Mientki stef.mientki at gmail.com
Wed Jan 27 15:12:37 CET 2010


hello,

I'm trying to kill processes,
I started myself with subprocess.popen,
under windows XP, Python 2.6

Why are the subprocess.Popen methods kill() and terminate () not working,
while a simple suggestion from this newsgroup, shown below, works perfect ?

thanks,
Stef Mientki


     My_Process = subprocess.popen ( ...)
     handle = win32api.OpenProcess(win32con.PROCESS_TERMINATE, 0, 
My_Process.PID)
     try:
       win32api.TerminateProcess(handle,0)
       win32api.CloseHandle(handle)
     except:   #the process might already be closed by the user
       pass

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20100127/bf5f9015/attachment.htm>


More information about the python-win32 mailing list