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


Groups > comp.lang.python > #29045

Re: subprocess call is not waiting.

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python@mrabarnett.plus.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.008
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'python': 0.09; 'exist.': 0.09; 'files"': 0.09; 'happens.': 0.09; 'subject:not': 0.11; 'times,': 0.13; 'copies),': 0.16; 'datasets': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'intended.': 0.16; 'loops': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'wait.': 0.16; 'wrote:': 0.17; 'successful,': 0.17; 'tries': 0.17; 'shell': 0.18; 'tests': 0.18; 'trying': 0.21; 'error.': 0.21; 'not,': 0.21; 'supposed': 0.21; 'tells': 0.22; 'runs': 0.22; "i've": 0.23; 'command': 0.24; 'script': 0.24; 'tried': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; "doesn't": 0.28; 'run': 0.28; 'post': 0.28; 'loop,': 0.29; 'received:192.168.1.3': 0.29; 'connection': 0.30; 'returned': 0.30; 'file': 0.32; 'etc.)': 0.32; 'quickly': 0.32; 'turns': 0.33; 'to:addr:python-list': 0.33; 'times.': 0.33; 'server': 0.35; 'data,': 0.35; 'open': 0.35; 'remote': 0.35; 'there': 0.35; 'but': 0.36; 'should': 0.36; 'data': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'back': 0.62; 'ever': 0.63; 'times': 0.63; 'email addr:gmail.com': 0.63; 'header :Reply-To:1': 0.68; 'internet': 0.71; 'reply-to:no real name:2**0': 0.72; 'prompt': 0.78; '"too': 0.84; 'around,': 0.84; 'communicate,': 0.84; 'reply-to:addr:python.org': 0.84
X-CM-Score 0.00
X-CNFS-Analysis v=2.0 cv=W6e6pGqk c=1 sm=1 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=AAvI7MrX_rgA:10 a=3F8dre34338A:10 a=ihvODaAuJD4A:10 a=OUOv7kDek9cA:10 a=8nJEP1OIZ-IA:10 a=EBOSESyhAAAA:8 a=8AHkEIZyAAAA:8 a=wfN0js7fSWEA:10 a=pGLkceISAAAA:8 a=tDGid9ojgIAsNT2i6vIA:9 a=wPNLvfGTeEIA:10 a=MSl-tDqOz04A:10 a=0nF1XD0wxitMEM03M9B4ZQ==:117
X-AUTH mrabarnett:2500
Date Thu, 13 Sep 2012 16:35:26 +0100
From MRAB <python@mrabarnett.plus.com>
User-Agent Mozilla/5.0 (Windows NT 5.1; rv:15.0) Gecko/20120907 Thunderbird/15.0.1
MIME-Version 1.0
To python-list@python.org
Subject Re: subprocess call is not waiting.
References <d49e1e71-afe2-4aab-8c67-3e2eea6533a6@googlegroups.com>
In-Reply-To <d49e1e71-afe2-4aab-8c67-3e2eea6533a6@googlegroups.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
Reply-To python-list@python.org
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.613.1347550525.27098.python-list@python.org> (permalink)
Lines 14
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1347550525 news.xs4all.nl 6884 [2001:888:2000:d::a6]:58673
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:29045

Show key headers only | View raw


On 2012-09-13 16:17, paulstaten@gmail.com wrote:
> I have a subprocess.call which tries to download a data from a remote server using HTAR. I put the call in a while loop, which tests to see if the download was successful, and if not, loops back around up to five times, just in case my internet connection has a hiccup.
>
> Subprocess.call is supposed to wait.
>
> But it doesn't work as intended. The loop quickly runs 5 times, starting a new htar command each time. After five times around, my program tells me my download failed, because the target file doesn't yet exist. But it turns out that the download is still happening---five times.
>
> When I run htar from the shell, I don't get a shell prompt again until after the download is complete. How come control is returned to python before the htar command is through?
>
> I've tried using Popen with wait and/or communicate, but no waiting ever happens. This is troublesome not only because I don't get to post process my data, but because when I run this script for multiple datasets (checking to see whether I have local copies), I quickly get a "Too many open files" error. (I began working on that by trying to use Popopen with fds_close, etc.)
>
> Should I just go back to os.system?
>
Which OS? Is there some documentation somewhere?

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


Thread

subprocess call is not waiting. paulstaten@gmail.com - 2012-09-13 08:17 -0700
  Re: subprocess call is not waiting. MRAB <python@mrabarnett.plus.com> - 2012-09-13 16:35 +0100
  Re: subprocess call is not waiting. woooee@gmail.com - 2012-09-13 10:24 -0700
    Re: subprocess call is not waiting. Hans Mulder <hansmu@xs4all.nl> - 2012-09-14 10:52 +0200
  Re: subprocess call is not waiting. Chris Rebert <clp2@rebertia.com> - 2012-09-13 22:27 -0700
  Re: subprocess call is not waiting. paulstaten@gmail.com - 2012-09-14 05:22 -0700
    Re: subprocess call is not waiting. Wanderer <wanderer@dialup4less.com> - 2012-09-14 10:38 -0700
    Re: subprocess call is not waiting. Chris Rebert <clp2@rebertia.com> - 2012-09-14 21:02 -0700
      Re: subprocess call is not waiting. paulstaten@gmail.com - 2012-09-15 05:59 -0700
        Re: subprocess call is not waiting. andrea crotti <andrea.crotti.0@gmail.com> - 2012-09-18 14:54 +0100
        Re: subprocess call is not waiting. Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-09-18 15:20 -0400
        Re: subprocess call is not waiting. andrea crotti <andrea.crotti.0@gmail.com> - 2012-09-19 11:26 +0100
          Re: subprocess call is not waiting. Hans Mulder <hansmu@xs4all.nl> - 2012-09-19 15:23 +0200
            Re: subprocess call is not waiting. Gene Heskett <gheskett@wdtv.com> - 2012-09-19 11:57 -0400
            Re: subprocess call is not waiting. andrea crotti <andrea.crotti.0@gmail.com> - 2012-09-19 17:34 +0100
              Re: subprocess call is not waiting. Hans Mulder <hansmu@xs4all.nl> - 2012-09-19 19:31 +0200

csiph-web