[Twisted-Python] Creating a protocol-agnostic chatbot with Twisted words

Ralph Meijer twisted at ralphm.ik.nu
Mon May 26 12:02:21 EDT 2008

On Mon, 2008-05-26 at 15:03 +0200, Jo Vermeulen wrote:
> [..]
> I had another question about the Jabber example (xmpp_client.py) in
> Twisted words. When I quit the application with Ctrl+C, it throws an
> exception:
> [..]

I haven't seen that behavior before, but I can confirm this happens. I
poked around a bit with the example. It seems that the socket is closed
before its factory is shut down. It might be that the reactor shutdown
procedure has changed, so I think this behavior is the result of a bug,
either in the example or somewhere else. It needs more investigation, so
it would be nice if you could file a ticket for it.

> Is there any way to modify this example so that it stops gracefully
> when Ctrl+C is pressed? Embedding the main script code in a try-except
> statement that catches KeyboardInterrupt doesn't help since Twisted
> seems to catch all exceptions itself.

I don't know of a good solution, at the moment. If the above bug gets
resolved, you shouldn't need to do anything beyond that.



More information about the Twisted-Python mailing list