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

Christopher Armstrong radix at twistedmatrix.com
Mon May 24 05:06:22 MDT 2004


Michael Hudson wrote:
> Andrew Bennetts <andrew-twisted at puzzling.org> writes:

>>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 ;)
> 
> 
> 4) check out pyrepl from CVS and help me debug the currently rather
>    hackish twisted support :-)
> 
> http://codespeak.net/pyrepl


Heeey, pyrepl is really cool... :-)

radix at radii ~/Projects/pyrepl/pyrepl% python python_reader.py

->> import sys; print sys.modules['twisted.internet.reactor']
<twisted.internet.default.SelectReactor instance at 0x40352e0c>
# woot, twisted's already being used :-)
->> from twisted.internet import reactor
->> from twisted.python.util import println
->> reactor.callLater(1, println, "\nhi!")
<twisted.internet.base.DelayedCall instance at 0x40522aac>
->>
     hi!

-- output there seems to do some weird stuff with whitespace, but 
anyway, this is pretty cool :-)



-- 
  Twisted | Christopher Armstrong: International Man of Twistery
   Radix  |          Release Manager,  Twisted Project
---------+           http://radix.twistedmatrix.com/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 256 bytes
Desc: OpenPGP digital signature
URL: </pipermail/twisted-python/attachments/20040524/31efa170/attachment.sig>


More information about the Twisted-Python mailing list