Search This Blog

Monday, August 18, 2014

Really Cool Python debugging Tool - "PUDB"

Hi once again,
I came across this really cool python debugging tool called "PUDB". Now i would rather say am using this tool for every code trace on openstack.

" PuDB is a full-screen, console-based visual debugger for Python. Its goal is to provide all the niceties of modern GUI-based debuggers in a more lightweight and keyboard-friendly package. PuDB allows you to debug code right where you write and test it--in a terminal. If you've worked with the excellent DOS-based Turbo Pascal or C tools, PuDB's UI might look familier. "

How to install PUDB

# sudo pip install pudb

How to debug

The place you feel debugger needs to start, insert the following piece of code  

import pudb;pu.db 

How does it look like ?

PUDB has the following panes
  • Debugger pane
  • Console Pane
  • Variables Pane
  • Stack Pane
  • BreakPoints pane
Basic Key Navigations
  • Use Left,Right,Up,Down arrow keys to navigate between the panes.
  • press 's' for step into a method
  • press 'n' for executing next line
  • press 'b' key to toggle break points
  • press 'r' for completing the method
  • press 'q' to quit debugger
  • press '?' for help and more key navigations
  • ctrl + x to navigate between debugger pane and console pane.
  • TAB key acts as auto-suggest/auto-fill while in console pane. It also brings down methods available.
Credits to my friend Rushi Agarwal - who pointed out to me about this tool while i was struggling to debug a piece of code with pdb :)