Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #4604
| Date | 2011-05-04 11:47 +0200 |
|---|---|
| From | Jean-Michel Pichavant <jeanmichel@sequans.com> |
| Subject | Re: Running and killing a process in python |
| References | <BANLkTi=kCto8wriosiGqPipYA_cE4AYTsg@mail.gmail.com> <BANLkTi=ScC8-kQVYZXZD9JVsKadqM1RXKw@mail.gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1145.1304502460.9059.python-list@python.org> (permalink) |
James Mills wrote: > On Wed, May 4, 2011 at 10:45 AM, Astan Chee <astan.chee@gmail.com> wrote: > >> Hi, >> I'm trying to make a python script (in windows 7 x64 using python 2.5) to >> start a process, and kill it after x minutes/seconds and kill all the >> descendants of it. >> Whats the best way of doing this in python? which module is best suited to >> do this? subprocess? >> > > Yes start with the subprocess module: > > http://docs.python.org/library/subprocess.html > > cheers > James > > As an alternative, you can have a look at http://codespeak.net/execnet/index.html This module is designed to execute processes on remote machines, but it works great on the local host as well. Among its features are: " - easy creation, handling and termination of multiple processes - fully interoperable between Windows and Unix-ish systems " While it has more feature than what you need, if you do simple things, it stays simple. (I never used subprocess with Windows, so I don't know if killing process is that easy. On *nix system, you should probably choose subprocess, execnet would be overkill) JM
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Running and killing a process in python Jean-Michel Pichavant <jeanmichel@sequans.com> - 2011-05-04 11:47 +0200
csiph-web