Nonblocking input

Nolan Darilek nolan_d at bigfoot.com
Wed Jul 5 20:13:16 EDT 2000


I tried to send this earlier, but after consulting the archives, it
didn't appear as if it made it. So now I'm subscribed and I'll try
again. :)

I'm trying to do nonblocking input with Python, but without using
curses. I'm writing a text-based, line-oriented client, and the cmd
module does almost exactly what I want, except for the fact that it
doesn't do nonblocking input. I've worked on this all day, and I'm
closer to a solution,though I'm still running into some problems.

The client currently uses a thread to read from the socket, and the
output is printed to the screen. The problem with this method is that
output gets intermingled with input. The obvious solution is to store
all input, reprint the last line of the display, then print the prompt
and stuff the old data back into the input buffer, but don't I need
nonblocking I/O for this? Or, is there some other module/method which
I am completely missing? I'd like to avoid using curses since 1) my
application uses only a single window, and doesn't need all of the
additional overhead which curses provides and 2) cmd provides an
interface which is perfect for what I am trying to write.




More information about the Python-list mailing list