On 05Sep2014 17:32, Crush <crushe...@gmail.com> wrote:
Ok nevermind, I did not figure it out. My code...
count = 0
while count < 3:
count += 1
Subprocess.Popen('command')
if count == 3:
sys.exit()
This does not work as I want it to; it consecutively executes the command
three times in a row. I only want it to execute once. However, if there is an
error, I want it to try again, but only if count does not equal 3. If count
equals 3, i want it to give up and exit or do something else.
1: PLease consider getting the list as individual messages instead of a digest.
Quoting the whole digest does not provide useful context, and the subject line
is terrible.
2: Look at the indentation above: you start 3 processes inside the loop, but
never wait for any of them, or examine their exit status (which is the usual
criterion for trying again, if you really believe a second attempt will help).
3: Please cut/paste your code instead of retyping it. You spell "Subprocess"
above with a capital "S", which it does not have. This leads me to think the
above it not your exact running code.
Cheers,
Cameron Simpson <c...@zip.com.au>
Nonsense. Space is blue, and birds fly through it. - Heisenberg
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor