[Mike Elkins wrote] > I'm trying to port some python code that uses the Popen3 class returned from > popen2.popen3 on linux. This isn't available on windows, so I thought I'd > try it using win32process. > > I figured out a way to call win32process.CreateProcess that actually spawns > a process, but calling win32process.TerminateProcess on the handle it > returns fails with 'Access Denied'. > > What would be the typical way someone would spawn a process and later kill > it? > > Sample Code: > import win32process > si = win32process.STARTUP_INFO() > details = win32process.CreateProcess('foo.exe','foo.exe > ',None,None,False,0,None,None,si) > win32process.TerminateProcess(details[0],99)
Check out .../Lib/site-packages/win32/Demos/winprocess.py. The latest cross-platform process-control gizmo in the Python world is the subprocess module (in Python 2.4). I don't believe it has any cross-platform support for killing processed though. You could try my process.py module (http://trentm.com/projects/process) but you should generally prefer 'subprocess' as it is more widely used. YMMV. Cheers, Trent -- Trent Mick [EMAIL PROTECTED] _______________________________________________ ActivePython mailing list ActivePython@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs Other options: http://listserv.ActiveState.com/mailman/listinfo/ActivePython