Skip to content

Instantly share code, notes, and snippets.

@radix
Created July 24, 2013 15:29
Show Gist options
  • Save radix/6071626 to your computer and use it in GitHub Desktop.
Save radix/6071626 to your computer and use it in GitHub Desktop.
inlineCallbacks tracebacks
>>> from twisted.internet.defer import inlineCallbacks
>>> @inlineCallbacks
... def a():
... yield b()
...
>>> @inlineCallbacks
... def b():
... yield c()
...
>>> def c(): 1 / 0
...
>>> a()
<Deferred at 0x21140e0 current result: <twisted.python.failure.Failure <type 'exceptions.ZeroDivisionError'>>>
>>> a().result.printTraceback()
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 1214, in unwindGenerator
return _inlineCallbacks(None, gen, Deferred())
File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 1071, in _inlineCallbacks
result = g.send(result)
File "<stdin>", line 3, in a
File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 1214, in unwindGenerator
return _inlineCallbacks(None, gen, Deferred())
--- <exception caught here> ---
File "/usr/lib/python2.7/dist-packages/twisted/internet/defer.py", line 1071, in _inlineCallbacks
result = g.send(result)
File "<stdin>", line 3, in b
File "<stdin>", line 1, in c
exceptions.ZeroDivisionError: integer division or modulo by zero
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment