Skip to content

Instantly share code, notes, and snippets.

@akaptur
Created November 15, 2012 17:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akaptur/4079971 to your computer and use it in GitHub Desktop.
Save akaptur/4079971 to your computer and use it in GitHub Desktop.
simple pdb traceback
import pdb
x = 0
while True:
pdb.set_trace()
y = "line of code not triggering an error"
x += 1
assert x != 3
Traceback (most recent call last):
File "minimal_pdb_traceback.py", line 7, in <module>
y = "line of code not triggering an error"
AssertionError
@akaptur
Copy link
Author

akaptur commented Nov 15, 2012

Run this code from the command line (python pdb_traceback.py). The set_trace() will launch the debugger. I hit 'c' each time I land on the breakpoint. After three passes, the program exits with the AssertionError and I see the traceback above, pointing to the wrong line of code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment