popen, Pipes with programs that expect user input
Gabriel Genellina
gagsl-py at yahoo.com.ar
Mon Jan 8 12:55:57 EST 2007
At Monday 8/1/2007 13:06, Alex wrote:
>So far everything works fine, but I encounter a problem with commands
>which require some sort of user input; i.e. they don't return
>immediately.
>
>Could someone point out the cause of this? It seems to me that the
>interpreter is stuck at this line
> data=fouterr.read()
>
>and it won't go forward unless popen returns. If so, how should the
>objective be achieved?
Read the docs on the popen2 module, specially the last section on
syncronization.
Depending on how bad your child process behaves (the date command in
this case) you may need to use up to three separate threads for
processing stdin, stdout, stderr.
--
Gabriel Genellina
Softlab SRL
__________________________________________________
Preguntá. Respondé. Descubrí.
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta).
¡Probalo ya!
http://www.yahoo.com.ar/respuestas
More information about the Python-list
mailing list