Anybody can help on this?
Jeff Shannon
jeff at ccvcorp.com
Fri Feb 22 13:09:08 EST 2002
husam wrote:
> >>> passout,passin=os.popen2("/home/husam/profit_1/profit")
> # Also tried calling this with "popen2.popen2()" no go.
> ....
> >>> passin.read()
> # Here it hangs, the only way to stop it is by pressing: ctrl+c
Yes, just to make it explicit, this will block until the pipe closes, i.e.,
the external program terminates. This can be a long time, depending on the
external program. :)
This can be avoided by reading single lines (which blocks until a full line
is available), or by specifying a number of bytes to read (which blocks
until that many bytes are available). I think there is also an optional
timeout, but it's been a while since I poked around with popen*() ...
(I see that you already found a solution, but I wanted to post this for the
benefit of anyone else who might be following along...)
Jeff Shannon
Technician/Programmer
Credit International
More information about the Python-list
mailing list