When at the pdb console, entering a statement which causes an exception results in just a single line stack trace, e.g.
(Pdb) someFunc()
*** TypeError: __init__() takes exactly 2 arguments (1 given)
However I’d like to figure out where exactly in someFunc the error originates. i.e. in this case, which class __init__ is attached to.
Is there a way to get a full stack trace in Pdb?
The easiest way would be to define a function in your code that calls someFunc() and prints the traceback then call that from Pdb.
Alternatively you can print the traceback for yourself. Given this source code:
Then we can do this: