[Twisted-Python] Re: Making a duck-typed traceback from a Failure

Jonathan Lange jml at mumak.net
Wed Feb 28 21:03:23 EST 2007


On 3/1/07, Jean-Paul Calderone <exarkun at divmod.com> wrote:
> On Thu, 1 Mar 2007 11:16:17 +1100, Jonathan Lange <jml at mumak.net> wrote:
> >2. What do I want to do with it
> >
> >I want to pass the duck-typed traceback along with the exception type
> >and exception value to traceback.format_exception.
> >
>
> Is it particularly important that the exception be formatted using that
> particular function?  Failure.printTraceback() exists to deal with the
> fact that Failure doesn't play nicely with the traceback module.
>

It is important. unittest in the standard library and the Zope
testrunner both use format_exception to display errors.

> If you absolutely must go through format_exception, then I guess you can
> create an object which is traceback-like enough for the traceback module.
> It probably wouldn't even be /that/ tedious.  I don't have any particular
> suggestions for doing this.  Traceback objects have some attributes, I
> think you'll just need to make a class and give it some attributes (and
> another for frames).
>

I'll do this then.

Thanks,
jml




More information about the Twisted-Python mailing list