Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'received:209.85.223': 0.03; 'file)': 0.07; 'python': 0.09; 'failed:': 0.09; 'guys.': 0.09; 'os.path': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr :python-list': 0.10; 'subject:not': 0.11; 'finished': 0.15; '64-bit,': 0.16; 'iteration.': 0.16; 'subprocess': 0.16; 'exists': 0.17; 'thanks,': 0.18; 'import': 0.21; 'cc:2**0': 0.23; 'split': 0.23; "i've": 0.23; 'cc:no real name:2**0': 0.24; 'tried': 0.25; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; 'prints': 0.29; 'sleep': 0.29; 'stuff': 0.30; 'file': 0.32; 'received:google.com': 0.34; 'moved': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'but': 0.36; 'should': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'from:no real name:2**0': 0.60; 'between': 0.63; 'difference.': 0.84; 'try.': 0.91 Newsgroups: comp.lang.python Date: Thu, 13 Sep 2012 11:36:40 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=155.101.20.22; posting-account=GcsUGQoAAADLaHeYfNbbstTwIReQSSmu References: <746448155.528147.1347550469072.JavaMail.root@sequans.com> User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-IP: 155.101.20.22 MIME-Version: 1.0 Subject: Re: subprocess call is not waiting. From: paulstaten@gmail.com To: comp.lang.python@googlegroups.com Content-Type: text/plain; charset=ISO-8859-1 Cc: python-list@python.org 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: , Message-ID: Lines: 24 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1347561410 news.xs4all.nl 6938 [2001:888:2000:d::a6]:53061 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:29065 Thanks, guys. MRAB-RedHat 6 64-bit, Python 2.6.5 JM-Here's the relevant stuff from my last try. I've also tried with subprocess.call. Just now I tried shell=True, but it made no difference. sticking a print(out) in there just prints a blank line in between each iteration. It's not until the 5 trials are finished that I am told: download failed, etc. from os.path import exists from subprocess import call from subprocess import Popen from shlex import split from time import sleep while (exists(file)==0) and (nTries < 5): a = Popen(split('htar -xvf ' + htarArgs), stdout=PIPE, stderr=PIPE) (out,err) = a.communicate() if exists(file)==0: nTries += 1 sleep(0.5) if exists(file)==0: # now that the file should be moved print('download failed: ' + file) return 1 I've also tried using shell=True with popopen.