Debugging in python
June 17th, 2008[ Geek ]
If you’re a tech caveman like myself then you may not have a loving relationship with IDE’s in general. Hang on, now that I think about it, I grew up with IDE’s and I’ve tried, and spent a lot of my career in, most of them. This isn’t a case of not wanting to use the kid’s fancy new tools. Ok, stopping tangent…
When I lived in the java enterprise world, I was a heavy jdb user. Yes, even in a java shop I was in the minority in using a “simple command-line debugger”. Sorry but I’m a simple guy.
Lucky for me, python has pdb which “defines an interactive source code debugger for Python programs. It supports setting (conditional) breakpoints and single stepping at the source line level, inspection of stack frames, source code listing, and evaluation of arbitrary Python code in the context of any stack frame. It also supports post-mortem debugging and can be called under program control.”
I don’t know for certain, however, if pdb is like jdb then this is the module that any python IDE is using to offer you debugging capabilities. They build their gui on top of this module and expose pretty pictures and some subset of pdb to you. That’s another reason I prefer to use, and understand, things like jdb and pdb instead of relying on an IDE’s rendition.
If you have any interest, there are the ugly details and a gentle introduction.