10. Debugging code

10.1. Post-morten

import ipdb
%debug

Toggle automatic postmorten debug:

%pdb

10.2. Easy breakpoint

Insert inside a function:

import ipdb
ipdb.set_trace()

10.3. Start debugging on the current terminal

import ipdb
ipdb.set_trace("", locals(), globals())

10.4. Debugger commands

  • h(elp):
  • w(here):
  • d(own):
  • u(p):
  • s(tep):
  • n(ext):
  • r(eturn):
  • c(ont(inue)):
  • j(ump):
  • l(ist):
  • p: