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


Groups > comp.lang.python > #5901

Re: how to get PID from subprocess library

References <ir3eu1$kgq$1@speranza.aioe.org>
From Kushal Kumaran <kushal.kumaran+python@gmail.com>
Date 2011-05-21 10:46 +0530
Subject Re: how to get PID from subprocess library
Newsgroups comp.lang.python
Message-ID <mailman.1872.1305955023.9059.python-list@python.org> (permalink)

Show all headers | View raw


On Thu, May 19, 2011 at 9:32 PM, TheSaint <nobody@nowhere.net.no> wrote:
> hello,
>
> I'm using to launch a program by subprocess.getstatusoutput. I'd like to
> know whether I can get the program ID, in order to avoid another launch.
>
> For clarity sake, I'm calling aria2 (the download manager for linux) and I
> wouldn't like to call one more instance of it. So what will I use to find
> the PID of the launched program?
>

The getstatusoutput function will only return when the command has
finished.  That's how it is able to give you the status.  So, if you
are using getstatusoutput, you will have only one instance of your
command running.

-- 
regards,
kushal

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

how to get PID from subprocess library TheSaint <nobody@nowhere.net.no> - 2011-05-20 00:02 +0800
  Re: how to get PID from subprocess library Kushal Kumaran <kushal.kumaran+python@gmail.com> - 2011-05-21 10:46 +0530
    Re: how to get PID from subprocess library TheSaint <nobody@nowhere.net.no> - 2011-05-21 20:50 +0800
      Re: how to get PID from subprocess library Kushal Kumaran <kushal.kumaran+python@gmail.com> - 2011-05-22 15:34 +0530
        Re: how to get PID from subprocess library TheSaint <nobody@nowhere.net.no> - 2011-05-22 21:41 +0800
          Re: how to get PID from subprocess library GMail Felipe <felipe.vinturini@gmail.com> - 2011-05-22 12:45 -0300
            Re: how to get PID from subprocess library TheSaint <nobody@nowhere.net.no> - 2011-05-23 19:06 +0800
      Re: how to get PID from subprocess library Anssi Saari <as@sci.fi> - 2011-05-24 13:45 +0300
        Re: how to get PID from subprocess library TheSaint <nobody@nowhere.net.no> - 2011-05-24 21:36 +0800

csiph-web