Custom Search

Monday, August 18, 2014

Debugging your Python Applications with pudb

https://pypi.python.org/pypi/pudb

1)
Install

#sudo easy_install pudb
OR
#pip install pudb




2)
To start debugging, simply insert one of the following statements into your code.


import pudb; pu.db

OR

import pudb
pu.db

OR

from pudb import set_trace; set_trace()

OR

from pudb import set_trace
set_trace()

3)
a)
This opens a window with a pop-up window


Press "Enter" to goto "Edit Preferences" pop-up window.

Press "Space" to select the settings

Press "Esc" to close the pop-up window

b)
Press "Ctrl" + "x" to goto Command Line.
Press "Ctrl" + "x" to exit from Command Line.

Press "n" to execute next line
Press "s" to step into a method/function
Press "c" to continue the execution

4)
How to Set breakpoint.

Use arrow key and select the line where you want to set the breakpoint and press "b", then you can see a red mark in that line.
Then Press "c" to continue the execution and stop at breakpoint



No comments:

Post a Comment