Search This Blog

Saturday, May 17, 2014

Python debugger cheat-sheet

Before using it:
import pdb
A break point in the code:
this will stop the interpreter at that point in the code. Just a quick reminder of the most important commands while debugging:
  • (Pdb) p <var>: print variable <var>
  • (Pdb) l: show current place in the code
  • (Pdb) u: move up on the stack
  • (Pdb) d: move down on the stack
  • (Pdb) n: execute the next statement
  • (Pdb) c: continue running (run until the end, or the next breakpoint)
  • (Pdb) r: continue running, but only until the end of the current subroutine
  • (Pdb) s: step into
  • (Pdb) q: quit
A great and more complete reference can be found here

No comments:

Post a Comment