stdout redirect : Howto with popen2.popen3

Fabien Hénon ffjhenon at club-internet.fr
Tue Apr 9 16:02:44 EDT 2002


I'll give it a try.

I may still do dumb mistakes . I am still a beginner.

Merci for the advice

Fabien

Eric Brunel a écrit :

> 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