Python debugger

import pdb
  1. Just before the line of code that is causing the bug , add a new line of code that says pdb.set_trace()

Using the debugger

The debugger works by pausing program execution wherever you write pdb.set_trace() in your code. You also have access to any variables which are accessible from that point in your code.

When you are done playing around, type c to continue program execution. Was the bug triggered? Keep playing until you have a guess about what is causing the bug.

Last updated