stdout redirect : Howto with popen2.popen3
Eric Brunel
eric.brunel at pragmadev.com
Mon Apr 8 06:46:39 EDT 2002
Fabien Henon wrote:
[snip]
> 2. How can I tell when the raytrace is over ? The poll() gets out of
> the loop.
> What is command to listen to a program to tell if it's running or not?
[snip]
> while run.poll() <>-1:
> print "attente" # // I never got to here and goes straight to
> fd=open.....
Errr, maybe you just inverted the condition? The library reference says for
the poll method on the Popen3 class: "poll() Returns -1 if child process
hasn't completed yet, or its return code otherwise.". So, if I understand
correctly, that means that while the child is running, poll() returns -1,
and when the child has exited, poll() returns its exit code. So your loop
should be:
while run.poll() == -1:
# etc...
Didn't try it though. HTH however...
- eric -
More information about the Python-list
mailing list