

To set up a breakpoint we would then do pdb.set_trace() as shown in the code below.

Prior to version 3.7 of Python we needed to import the PDB module at the top of the program that we needed to import. It also allows us to interrogate our code line by line, pause and resume the execution of our code as we inspect variable execution.īy doing so we are able to determine how each line of code affects the flow of the program. The PDB module allows us to set breakpoints within our code. In this article, you’ll learn how to debug in Python by using different methods. This module is provided by the standard library and therefore needs no installation. The built-in module PDB is an interactive source code debugger for Python programs. Debugging is a very important aspect of writing programs that every developer should master.
