[Twisted-Python] A question about errorback failure objects

Jean-Paul Calderone exarkun at divmod.com
Wed Sep 24 08:01:23 MDT 2008


On Wed, 24 Sep 2008 14:47:02 +0200, Vasil Vangelovski <vvangelovski at gmail.com> wrote:
>When an errorback gets called with a failure parameter what is the
>best way to get the stack trace (to see what lines at what files
>caused the error)?
>

You can find the API documentation for failures here:

  http://twistedmatrix.com/documents/current/api/twisted.python.failure.Failure.html

You might be interested in the printTraceback method.  You can also
pass a failure to twisted.python.log.err and a traceback will be written.

Keep in mind, however, that not all failures have tracebacks.  If you try
printing a failure's traceback and don't see anything interesting, this
may be because the failure wasn't created with a traceback.  In this case,
running with failure debugging enabled (eg, with twistd --debug) may provide
more useful information, since it will set a breakpoint on failure creation,
letting you inspect the creation context.

Jean-Paul




More information about the Twisted-Python mailing list