Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #4604 > unrolled thread

Re: Running and killing a process in python

Started byJean-Michel Pichavant <jeanmichel@sequans.com>
First post2011-05-04 11:47 +0200
Last post2011-05-04 11:47 +0200
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Running and killing a process in python Jean-Michel Pichavant <jeanmichel@sequans.com> - 2011-05-04 11:47 +0200

#4604 — Re: Running and killing a process in python

FromJean-Michel Pichavant <jeanmichel@sequans.com>
Date2011-05-04 11:47 +0200
SubjectRe: Running and killing a process in python
Message-ID<mailman.1145.1304502460.9059.python-list@python.org>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web