read and readline hanging

Thomas Bellman bellman at lysator.liu.se
Sun Jan 27 15:21:22 EST 2008


Olivier Lefevre <lefevrol at yahoo.com> wrote:

>> Can you really? 

> Yes interactively: at the command prompt, you can tell when it's over
> because you know the command you just sent and whether it requires an
> answer and of which kind. Also, even if there is no answer you get a
> fresh prompt when the interpreter is done.

Then you just need to encode that knowledge into your program.

>> Unless there is some way to differentiate between the last line
>> and all the other lines of a response, you can't really be sure.

> Yes, that has since occurred to me. I need to echo some magic string
> after each command to know that I reached the end of the answer to
> the previous command. In interactive mode the prompt fulfills that
> role.

And hope that that "magic string" does not occur somewhere within
the response...

> Yes but my python threading is worse than rudimentary. I will look
> into the `trheading` module suggested by the other poster.

I think you would be better off looking into the correctly spelled
'threading' module rather than the misspelled 'trheading' module. :-)


-- 
Thomas Bellman,   Lysator Computer Club,   Linköping University,  Sweden
"God is real, but Jesus is an integer."      !  bellman @ lysator.liu.se
                                             !  Make Love -- Nicht Wahr!



More information about the Python-list mailing list