Wednesday, May 8, 2013

I heart Doug Hellmann

The most straightforward way to use the debugger is to run it from the command line, giving it your own program as input so it knows what to run.
from his PyMOTW blog on pdb. FYI: you can replace pdb with ipdb.
$ python -m ipdb myscript.py argv1 argv2 ...
This solves the "importing ipdb twice breaks color coding" bug I posted here.

[UPDATE 2013-06-04] Just learned that ipdb also ships with a script that you can run directly from the command line..
$ ipdb myscript.py argv1 argv2 ...
Does the same as the python -m, but with 10 less key strokes, score! (ha, ha, ha!)

No comments:

Post a Comment

Fork me on GitHub