On Jun 23, 6:33 pm, geoffbache <[EMAIL PROTECTED]> wrote: > Hi all, > > I've always wondered why os.kill isn't supported on Windows. I found a > discussion somewhere from 2006 about this so it seems others have > wanted it, but still nothing. So I have a half-baked solution > involving calling "taskkill" on Windows Vista or "tskill" on Windows > XP via the shell. I feel there has to be a better way. > > I'm also fairly confused about when I've got an ID and when I've got a > handle. The subprocess module gives me IDs which the above programs > accept, but other ways of spawning processes give me process handles > (while referring to them as process IDs in the docs...) and I don't > know how to kill a process with these. Besides, I've found an > amazingly useful PyGTK method, gobject.child_watch_add, which does > exactly what I want on UNIX but wants process handles on Windows. So I > can't use it in conjunction with subprocess there, and if I use some > other way of spawning processes I can't clean them up later. > > Is there any way to convert one of these numbers to the other? Or to > get a process handle out of subprocess? > (There must be one down there somewhere, surely?) > > Sorry for rambling a bit, am confused. > > Regards, > Geoff Bache
My way to do it is using excellent wmi module by Tim Golden, which relies on Mark Hammond's pywin32 and Windows native wmi functionality. Here is the link - http://tgolden.sc.sabren.com/python/wmi.html Maybe, there is a more elegant way of doing that, but it works for me, and i feel nice with wmi. -- http://mail.python.org/mailman/listinfo/python-list