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: 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 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: <8761zxdyzb.fsf@dpt-info.u-strasbg.fr> In-Reply-To: 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 On 04/08/2013 08:01 AM, Dylan Evans wrote: > On Mon, Apr 8, 2013 at 9:48 PM, Alain Ketterlin > wrote: > >> loial 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