On Mon, Jul 16, 2012 at 11:45 PM, Dan Stromberg
On Mon, Jul 16, 2012 at 11:20 PM, Andrew Bennetts
wrote: Dan Stromberg wrote: […]
I'm playing with twisted.internet.defer.setDebugging now.
Is there a corresponding function that can be used to produce its report? If I use it in a program with an infinite loop, it seems like I never get the report, but if I use it in a program with a finite length, I eventually get a useful-looking report.
It's triggered by garbage collection of a Deferred with an unhandled error. So you're at the mercy of when the garbage collector of your Python VM decides to collect that object.
You could call yourDeferred._debugInfo._getDebugTracebacks() yourself, though, if you don't mind (ab)using private attributes that might break without warning.
Strangely, this doesn't give the report until after the sleep finishes... ?
It turned out that I needed to print d._debugInfo._getDebugTracebacks(),
rather than just running d._debugInfo._getDebugTracebacks(). However, it always appears to print the debug tracebacks for the deferred named - in this case, d. It doesn't appear to be selecting the correct deferred(s) to print.