[Twisted-Python] Controlling twisted via stdin
Christopher Armstrong
radix at twistedmatrix.com
Mon Mar 24 23:52:26 EDT 2008
On Mon, Mar 24, 2008 at 11:27 PM, Brian Baquiran
<brianbaquiran at gmail.com> wrote:
> How do I use the reactor.addReader/Writer methods?
>
> I would like to control a twisted server using stdin. Does data on stdin
> get passed to a protocol's dataReceived?
The simplest way to get a protocol running on stdio has nothing to do
with addReader and addWriter, and you likely want to stay away from
them.
Try using twisted.internet.stdio.StandardIO(protocolInstance).
(that's a protocol *instance*, not a factory or class)
There's an example in doc/core/examples/stdin.py, and a more complex
demo at doc/core/examples/stdiodemo.py.
--
Christopher Armstrong
International Man of Twistery
http://radix.twistedmatrix.com/
http://twistedmatrix.com/
http://canonical.com/
More information about the Twisted-Python
mailing list