[Twisted-Python] Re: Synchronization techniques

glyph at divmod.com glyph at divmod.com
Fri Apr 6 17:28:49 EDT 2007

On 06:18 pm, list-ener at strank.info wrote:
>on 04.04.2007 23:40 glyph at divmod.com said the following:

>>Run "python -m twisted/conch/stdio" for an example of an interactive
>>Here's a screenshot of an interactive session using the command above:

>Am I right that this is a screenshot of the manhole client?

Sort of.  It's the manhole server (I don't know what you mean by 
"client") running on standard IO, run via 'python -m 
>For embedding this in twisted, the twisted reactor needs to be the one 
>calling IPython/pyreadline when necessary.
>On the IPython level, I think this should be "easy" by subclassing the 
>Shell and splitting/rearranging the relevant code, so that it can be 
>called back at the point where raw_input would normally return.
>(I did not look at the new IPython saw branch...)

>On the twisted side, I think that something like twisted.internet.stdio 
>would be calling back?

Rather than IPython calling into raw_input, the loop that calls 
raw_input would have to be changed to a function that takes a string. 
This would almost certainly be the trickiest part, since it seems there 
are about two dozen places (at a quick glance) in ipython that call 
>Or rather something like twisted.conch.insults?

insults will be getting its events from twisted.internet.stdio, so both 
will be involved.
>I suspect that it would be hard to recode pyreadline in a way that it 
>could be called back by twisted?
>So to get readline support, something like readline would need to be 
>implemented using t.i.stdio / insults.
>Does this seem possible, so far? :-)

To me, sure - although I hardly have the time to do it :).  There have 
been a few forays into line-editing code for insults, although I'm not 
clear of the current state of the art, JP Calderone should be returning 
from vacation soon and will probably have some light to shed on the 
issue.  I don't know much about pyreadline.  There may be code there 
that's reusable, maybe not, but in any event it is a goal of the insults 
library to provide high-quality event-driven line-editing.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20070406/a7887903/attachment.htm 

More information about the Twisted-Python mailing list