how to get PID from subprocess library

Kushal Kumaran kushal.kumaran+python at gmail.com
Sat May 21 01:16:41 EDT 2011


On Thu, May 19, 2011 at 9:32 PM, TheSaint <nobody at 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



More information about the Python-list mailing list