$ ./runtests.py -v tests/managers/test_customer.py:CustomerManagerTest.test_register_without_subscription --ipdb
...
test_register_without_subscription (tests.managers
This has frustrated me too for a while. I eventually found the answer here, along with a good detailed explanation.
The short answer is, use the !
magic prefix (!sys.exc_info()
):
In [4]: 1/0
---------------------------------------------------------------------------
ZeroDivisionError Traceback (most recent call last)
...
ipdb> !sys.exc_info()
(, AttributeError("'exceptions.ZeroDivisionError' object has no attribute '_render_traceback_'",), )
This basically tells the debugger: "guessing wouldn't be necessary. it is python code I'm typing", thus preventing it from trying to guess what you mean by "sys", a process during which some internal exception is raised, overwriting sys.exc_info()
, which used to hold your original exception.