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


Groups > comp.lang.python > #29040

subprocess call is not waiting.

Received by 10.66.89.196 with SMTP id bq4mr713593pab.26.1347549435645; Thu, 13 Sep 2012 08:17:15 -0700 (PDT)
Received by 10.68.238.201 with SMTP id vm9mr41502pbc.6.1347549435629; Thu, 13 Sep 2012 08:17:15 -0700 (PDT)
Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!v8no2327002qap.0!news-out.google.com!a8ni4572pbd.1!nntp.google.com!4no6639406pbn.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups comp.lang.python
Date Thu, 13 Sep 2012 08:17:15 -0700 (PDT)
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=155.101.20.22; posting-account=GcsUGQoAAADLaHeYfNbbstTwIReQSSmu
NNTP-Posting-Host 155.101.20.22
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <d49e1e71-afe2-4aab-8c67-3e2eea6533a6@googlegroups.com> (permalink)
Subject subprocess call is not waiting.
From paulstaten@gmail.com
Injection-Date Thu, 13 Sep 2012 15:17:15 +0000
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
Xref csiph.com comp.lang.python:29040

Show key headers only | View raw


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?

Back to comp.lang.python | Previous | NextNext 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