Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.022 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'instance': 0.05; 'subject:library': 0.09; 'pm,': 0.10; 'wrote:': 0.14; 'linux)': 0.16; 'subject:subprocess': 0.16; 'received:74.125.82.174': 0.16; 'received:mail-wy0-f174.google.com': 0.16; "wouldn't": 0.17; 'cc:addr:python-list': 0.17; 'command': 0.19; 'header:In-Reply- To:1': 0.21; 'thu,': 0.22; 'cc:2**0': 0.22; 'cc:no real name:2**0': 0.23; 'function': 0.25; "i'm": 0.27; 'sender:addr:gmail.com': 0.28; 'message-id:@mail.gmail.com': 0.28; '(the': 0.28; 'subject:how': 0.29; 'cc:addr:python.org': 0.30; 'it.': 0.31; 'calling': 0.31; 'using': 0.35; 'received:google.com': 0.37; 'another': 0.37; 'received:74.125.82': 0.38; 'received:74.125': 0.38; 'hello,': 0.38; 'subject:from': 0.38; 'subject:: ': 0.38; 'skip:s 20': 0.39; "i'd": 0.39; 'launch': 0.39; 'more': 0.60; 'your': 0.60; 'order': 0.62; 'launched': 0.65; 'launch.': 0.84; 'to:addr:nobody': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:from :date:x-google-sender-auth:message-id:subject:to:cc:content-type; bh=mqDiEnli3eV+p9tZNmAFmsLeBnVs4R41s3w5cvn3aWg=; b=ePCYA+78MMC1AO/HOVm8mytl6PlwpPXgStneAxVlh0klSOo93aFjj8MH7guxa+uh8I KvkVjUt5t60woK4r2f0kT1+ZvsHoMzBfhTC/kVwtnJx6jhGNfuyWY9pTEA2GGiGnzcj7 3cHm943ynoaGYTDF2TnTSgHBqQ3N0MgQNh5Ag= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; b=ueMb54du/x+NW8yQbipmIZjDGAKhRLr2/MQDu8l2g8lczuNPjlCfGZX05gHp9B/9jA cZFKEOsEyJEyTV9gEtDdlUEEmSo1jJJEzH3N/YI0E5/cCY/wF3sNgDOP3ttTwWMxezvc nTXjsI4WyYp/DCX1L6Ohh7rqi9jUU6Noj+KpY= MIME-Version: 1.0 Sender: kushal.kumaran@gmail.com In-Reply-To: References: From: Kushal Kumaran Date: Sat, 21 May 2011 10:46:41 +0530 X-Google-Sender-Auth: ui_ZJr7h_UnMQqrCzvfejxF8tk8 Subject: Re: how to get PID from subprocess library To: TheSaint Content-Type: text/plain; charset=UTF-8 Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 19 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1305955023 news.xs4all.nl 49184 [::ffff:82.94.164.166]:45623 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:5901 On Thu, May 19, 2011 at 9:32 PM, TheSaint 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