[IPython-user] debugging a piece of a module

belinda thom bthom at cs.hmc.edu
Sat Dec 9 22:43:25 CST 2006


Hi,

I can't seem to find the functionality I'm looking for w/%magic's  
documentation.

I've got a python file w/a bunch of utility functions in it (nothing  
else, no classes, no __main__ check).

I want to be able to use the debugger (%pdb) to run a particular  
function in that file. The only way I've found to do that is to add  
some line at the bottom that calls the function I'd like to test, and  
to then do

%run -d <file> -b<line inside function I'd like to inspect>

I'd much prefer being able to run the function itself, but it doesn't  
appear that %run has such an option.

It seems a very common thing to want to do; perhaps I'm missing  
something.

As always, advice appreciated.

--b


More information about the IPython-user mailing list