[Twisted-Python] How do I get the reactor to stop on an exception

Jean-Paul Calderone exarkun at divmod.com
Tue Jun 3 17:37:00 EDT 2008

On Tue, 3 Jun 2008 17:23:57 -0400, Gerrat Rickert <grickert at coldstorage.com> wrote:
>I'm running a rather involved simulation using twisted, and it would be
>preferable if I could get the reactor to just drop me into the
>interpreter on any exception so I could examine the current state of

Unit tests are a great way to squash bugs quickly and permanently.

>I set os.environ['PYTHONINSPECT'] = '1', but the reactor seems to trap
>any exceptions and just merrily carry on - logging my tracebacks to a
>file, but continuing to run - modifying the current state of things and
>making it harder to track down bugs.
>Is there an easy way to prevent the reactor from trapping exceptions?

No, there's not.  However, you might be interested in the --debug option
to twistd, which will drop you into pdb when an unhandled exception is


More information about the Twisted-Python mailing list