[Twisted-Python] Interactive control of client?

Andrew Bennetts andrew-twisted at puzzling.org
Tue Jun 24 04:16:48 MDT 2003


[Wow, your MUA must have the narrowest editing area I've ever seen!]

On Fri, Jun 20, 2003 at 04:58:20PM -0700, Joel Boehland wrote:

[..snip..]

> I'm imagining being able to do something like this in the python
> interpreter:
> 
> >>>echoclient = SomeWayToGetClient(...)
> >>>echoclient.sendLine("blah")
> >>>echoclient.sendLine("bleh")
> 
> I'm assuming I would have to have the client run in another thread to be
> able to allow the python interpreter thread to run as well, but I'm not
> sure how I would do that. Any Info/help appreciated!

Slightly different to what you're asking...

Try adding a "manhole" to your application.  The quick and dodgy way is 

    from twisted.tap.telnet import updateApplication
    updateApplication(app, 
                      {'username':'admin', 'password': '****', 'port':2323})

(where app is your Application instance)

This will add telnet interface to your program that presents you with a
python prompt.  It can be convenient for playing around in a live Twisted
app.

-Andrew.





More information about the Twisted-Python mailing list