Re: Running and killing a process in python

Discussion in 'Python' started by Jean-Michel Pichavant, May 4, 2011.

  1. James Mills wrote:
    > On Wed, May 4, 2011 at 10:45 AM, Astan Chee <> 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
     
    Jean-Michel Pichavant, May 4, 2011
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Shruti A via .NET 247
    Replies:
    0
    Views:
    753
    Shruti A via .NET 247
    May 15, 2004
  2. brolewis

    Spawning, and Killing, a Process

    brolewis, Jan 31, 2005, in forum: Python
    Replies:
    0
    Views:
    342
    brolewis
    Jan 31, 2005
  3. Replies:
    1
    Views:
    308
    Knute Johnson
    Mar 26, 2009
  4. James
    Replies:
    3
    Views:
    435
    James
    Jul 11, 2006
  5. Federico
    Replies:
    9
    Views:
    265
    Abhinav
    Sep 17, 2004
Loading...

Share This Page