How to Start the Debugger

You can start the debugger three different ways. The first is to just import it and insert pdb.set_trace() into your code to start the debugger. You can import the debugger in IDLE and have it run your module. Or you can call the debugger on the command line. We’ll focus on the last two methods in this section. We will start with using it in the interpreter (IDLE). Open up a terminal (command line window) and navigate to where you save the above code example. Then start Python. Now do the following:

Get hands-on with 1200+ tech skills courses.