Friday, January 8, 2010

Debugging nosetests with ipdb

Ever wanted to debug Python with tab completion and syntax highlighting? Then you'll love ipdb:

sudo easy_install ipdb

The only thing you have to do is use ipdb instead of pdb:

import ipdb; ipdb.set_trace()

With a little trick it will even work with nosetests:

import sys; sys.stdout = sys.__stdout__; import ipdb; ipdb.set_trace()