Readline()

Sick Monkey sickcodemonkey at gmail.com
Mon Mar 12 21:51:27 EDT 2007


Maybe if you show us your code we can better assist you.

But maybe you can use a global variable or a try-catch method to keep
threads from staying alive and help better control your code.

On 3/12/07, Taylor, Stuart <Stuart.Taylor at disney.com> wrote:
>
>  I have been working on running an external process using subprocess.popenfor 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.writethen
> 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
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20070312/14c58efa/attachment.html>


More information about the Python-list mailing list