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


Groups > comp.lang.python > #43065

Re: subprocess question re waiting

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <davea@davea.name>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.097
X-Spam-Evidence '*H*': 0.81; '*S*': 0.00; 'alain': 0.09; 'subject:question': 0.10; 'finish.': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'shell': 0.22; 'header:User-Agent:1': 0.23; 'mon,': 0.24; 'script': 0.25; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'url:mailman': 0.30; 'code': 0.31; 'writes:': 0.31; 'run': 0.32; 'url:python': 0.33; 'url:listinfo': 0.36; 'url:org': 0.36; 'url:library': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'url:mail': 0.40; 'how': 0.40; 'first': 0.61; 'received:74.208': 0.68; 'received:74.208.4.194': 0.84; '2013': 0.98
Date Mon, 08 Apr 2013 08:22:53 -0400
From Dave Angel <davea@davea.name>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130308 Thunderbird/17.0.4
MIME-Version 1.0
To python-list@python.org
Subject Re: subprocess question re waiting
References <ed0010ee-471d-4cbe-ae6c-1d9a172b2ffc@googlegroups.com> <8761zxdyzb.fsf@dpt-info.u-strasbg.fr> <CADQvV+vM529iuHFnEJyuuwEtQDYbg-MuY-4R7+YmbGO_HTGm4g@mail.gmail.com>
In-Reply-To <CADQvV+vM529iuHFnEJyuuwEtQDYbg-MuY-4R7+YmbGO_HTGm4g@mail.gmail.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Provags-ID V02:K0:Q6yJJdvHmXh8rIAp1YLjPGE+7945Qhvk3SJ7YrX8Q/F Vr6jrQkuW2SFJAZJKrzZKB2WdAgQCbsivgOVQKTS09ILMjTTCo /DdY1GfrhZZKb1skYgCXJNfaKz/Tbrlco+eYriCdCABF9r38y5 i3ga/qOmT5Db9pg2EvzUEYlfJekyUNGfUH5Bl05ALW+treWgXV M/MOpqUyk8dJvaoWhDBuHLxruM9eoI7cEhWgfEjr3I/E+IjTQX mqsbU4WwSBMspE3rSdFoTip8qlEEBSDvWhVwFHkTNiklbkchAS HcIkDFODnCNgBIJL45KUWFpn0W2pNlgU+4iu3idREx0hjAc7w= =
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.285.1365423791.3114.python-list@python.org> (permalink)
Lines 33
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1365423791 news.xs4all.nl 6888 [2001:888:2000:d::a6]:46352
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:43065

Show key headers only | View raw


On 04/08/2013 08:01 AM, Dylan Evans wrote:
> On Mon, Apr 8, 2013 at 9:48 PM, Alain Ketterlin <alain@dpt-info.u-strasbg.fr
>> wrote:
>
>> loial <jldunn2000@gmail.com> writes:
>>
>>> I want to call a child process to run a shell script and wait for that
>>> script to finish. Will the code below wait for the script to finish?
>>> If not then how do I make it wait?
>> [...]
>>> process = subprocess.Popen(command,
>> stdin=subprocess.PIPE,stdout=subprocess.PIPE, stderr=subprocess.PIPE,
>> close_fds=True, shell=True)
>>
>> process.wait()
>>
>
> Or use subprocess.call instead which does what you want.
>
>
>> -- Alain.
>> --
>> http://mail.python.org/mailman/listinfo/python-list
>>
>

http://docs.python.org/2/library/subprocess.html#popen-objects

or use communicate(), which is what the OP had in the first place.


-- 
DaveA

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


Thread

subprocess question re waiting loial <jldunn2000@gmail.com> - 2013-04-08 04:00 -0700
  Re: subprocess question re waiting Alain Ketterlin <alain@dpt-info.u-strasbg.fr> - 2013-04-08 13:48 +0200
    Re: subprocess question re waiting Dylan Evans <dylan@dje.me> - 2013-04-08 22:01 +1000
    Re: subprocess question re waiting Dave Angel <davea@davea.name> - 2013-04-08 08:22 -0400
    Re: subprocess question re waiting Dylan Evans <dylan@dje.me> - 2013-04-08 22:58 +1000
  Re: subprocess question re waiting Dave Angel <davea@davea.name> - 2013-04-08 08:25 -0400

csiph-web