subprocess call is not waiting.
paulstaten at gmail.com
paulstaten at gmail.com
Thu Sep 13 14:36:40 EDT 2012
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.
More information about the Python-list
mailing list