ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> activepython
activepython
Re: Creating and terminating a process using win32process
by Trent Mick other posts by this author
Nov 24 2005 6:05PM messages near this date
view in the new Beta List Site
Creating and terminating a process using win32process | ANN: ActivePython 2.4.2 is now available
[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
TrentM@[...].com
_______________________________________________
ActivePython mailing list
ActivePython@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Other options: http://listserv.ActiveState.com/mailman/listinfo/ActivePython
Thread:
Mike Elkins
Trent Mick

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved