[Twisted-Python] example stdin handling client that supports readline?

Andrew Bennetts andrew-twisted at puzzling.org
Sun May 23 18:59:22 EDT 2004

On Sun, May 23, 2004 at 08:24:37PM +0200, Ellers wrote:
> I notice that there is a class
> 	twisted.internet.stdio.StandardIO
> that provides a file descriptor wrapper around stdin etc.
> This looks good, but I'm not sure how to connect this with the cool 
> readline functionality, which seems to block and take care of all handling 
> of stdin?

I'm not aware of anyone using readline with Twisted.  A couple of options
spring to mind:
    - use curses (see doc/examples/cursesclient.py for an example of using
      curses in Twisted) to make your own readline-like functionality
    - run readline in a thread, and get it to call
      reactor.callFromThread(something.gotStdinLine, ...) everytime a user
      hits enter.
    - just write a GUI interface, and forget readline ;)


More information about the Twisted-Python mailing list