[IPython-user] debugging a piece of a module

Fernando Perez fperez.net@gmail....
Sun Mar 18 23:05:52 CDT 2007


On 12/9/06, belinda thom <bthom@cs.hmc.edu> wrote:
> 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.

I looked briefly at the pdb docs and didn't find an easy way to add
this functionality, I'm afraid.

If R. Bernstein, our resident debugger guru, has ideas or patches to
enable this, they'd be obviously welcome.

Cheers,

f


More information about the IPython-user mailing list