Readline()

Taylor, Stuart Stuart.Taylor at disney.com
Mon Mar 12 16:29:27 CET 2007


I have been working on running an external process using
subprocess.popen for a few days.
The process is ran over the network to another machine.
One thing I have found is that if I perform readline() on the stdout it
will hang if the process loses connection.

I have tried a few things in a test example: one is to use stdin.write
then stdin.flush() which send a string that readline() will read and it
ends correctly but doesn't work on the project I need it to work on.
Another is to try using threads and ignoar the thread when  the process
has lost connection but this still leaves the open thread alive even
when the main app has finished.

I am relatively new to python and I may be making a fundemantal mistake
in my implementation, can anyone please inform me of whether sticking
with subprocess.popen and readline() is the correct procedure for this
sort of task?

And if anyone can point me in the correct implementation of this problem
I would be gratefull.


Thank you

Stuart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20070312/af23db64/attachment.html>


More information about the Python-list mailing list