After an exception occurs, you can call debug to jump into the Python debugger (pdb) and examine the problem.
More debugging