The easiest way is to define a function in your code that calls someFunc () and prints a trace, and then call it from Pdb.
Alternatively, you can print a trace for yourself. Given this source code:
def foo(a): pass def bar(b): foo(b, 2) def some_func(): bar(3) if __name__=='__main__': import pdb pdb.set_trace()
Then we can do this:
C:\temp>test.py --Return-- > c:\temp\test.py(12)<module>()->None -> pdb.set_trace() (Pdb) import traceback (Pdb) exec "try: some_func()\nexcept: traceback.print_exc()" Traceback (most recent call last): File "<string>", line 1, in <module> File "C:\temp\test.py", line 8, in some_func bar(3) File "C:\temp\test.py", line 5, in bar foo(b, 2) TypeError: foo() takes exactly 1 argument (2 given) (Pdb)
source share