views:

31

answers:

3

I'm using PDB a lot and it seems it would be even better if I could add systax highlighting in color.

Ideally, I'd like to have to the path to the code a lighter color. The line of actual code would be syntax highlighted.

I'm using OS X and the Terminal app. Python 2.7

A: 

This might not possible for you, but have you tried using a graphical debugger (like the one in eclipse/pydev)? It will give you your syntax highlighting and much more.

I only use pdb directly if I don't have an option, because a graphical interface is just that much nicer.

Mattias Nilsson
+3  A: 

pdb doesn't support colorization. However, it's not that hard to get it, even if you're a command-line addict (as I am;-) -- you don't have to switch to GUIs/IDEs just to get colorization while debugging Python. In particular, command-line tools usually work much better when you're accessing a remote machine via SSH, saving a lot of the bandwidth and latency issues that any remote access to GUIs and IDEs can inflict on you;-).

Specifically, for the task you're asking about, consider ipdb (you also need ipython, which offers a far more advanced shell than plain interactive Python, on which ipdb relies). Both offer you good tab completion, enhanced tracebacks, and colorization -- ipython for your normal interactive work, ipdb with the same features when you're debugging (otherwise just about the same as pdb).

Alex Martelli
A: 

Take a look at pdb++ - it is a drop-in replacement for pdb that fills all your requirements and adds some other nice features such as tab completion and new commands such as watch and sticky.

Dave Kirby