Python has embedded debugged called pdb. It is very useful for debugging exceptions that are not handled.
To debug a python program
1- Just add two lines to the beginning of the debugged python source file:
2- Then run the program. There will be a pdb prompt shown:
3- Then continue with “n” key through the lines.
4- While traversing, you can
Use Enter without “n” to run the last line
Use “p variablename” syntax for printing the value of the variable.
Use “l” to see the position in the code view
Use “c” to allow the program to continue without debugging