How do I debug using pdb ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How do I debug using pdb ?

instead of print debug

4th Feb 2017, 3:02 PM
T Y
T Y - avatar
3 Answers
+ 2
just write this line before code to debug : import pdb ; pdb.set_trace() and run your program.The execution of the program will then freeze, and in console you will have access to a special shell : (pdb) then press on 'h' to get more help.
4th Feb 2017, 6:18 PM
Adel
Adel - avatar
+ 1
adel thanks What is difference between step and next command ? on (pdb)shell
5th Feb 2017, 4:52 AM
T Y
T Y - avatar
+ 1
(n)ext allow you to run the next line even if the line contain a function call, (s)tep in the other hand jump inside that function to debug its content
6th Feb 2017, 9:02 PM
Adel
Adel - avatar