2008-08-16

Debugging Python scripts

I was trying to squash a bug (for the reference, #494545) of reportbug and I felt I needed a tool to help me debugging that Python script.

So googling up a bit, I came across pdb: it's a really powerful tool, and this guide helped me getting used to it (another one, with extended examples, is here).

Whilst for sure the power of import pdb;pdb.set_trace() is huge and keep adding it in the right places let me fix the bug, but what I was really searching for was something like set -x for a shell script, something that without touching the code, would allow me to debug it. Any suggestions?

1 comment:

Clinton said...

python -m trace --trace foo.py

is similar to sh -x

cheers,