[Twisted-Python] What is the "Twisted" way to kill stuck child process

Alan McIntyre alan at norfolkgraphics.com
Thu Feb 12 19:46:29 EST 2004

os.kill() isn't available on Windows, at least not in my version of 
Python 2.3.

I wrote a C extension that would allow me to shut down some programs, 
but I had to get a handle to a process' window before I could get its 
PID.  Since I knew the class names and/or window caption text of the 
windows in the applications I wanted to close, I stopped when I figured 
out how to find the window handles and didn't look into it any more.

If you can get the PID from some other source, you can write an 
extension to use OpenProcess and TerminateProcess to get a handle to the 
process and kill it.

Let me know if you'd like some code samples and I can go dig them up.

Jp Calderone wrote:
>   If popen2 lets you get PIDs on Windows, and os.kill() works with those
> PIDs on Windows, I think you should still be able to timeout processes
> fairly easily.  If they don't, maybe someone with more Windows experience
> can chime in.

More information about the Twisted-Python mailing list