4 ms·
Debugging in Python (2009)
- mrshoe 16y agoThe lack of discussion about pdb on the internet speaks to Python's simplicity and transparency. There just aren't many subtle traps to fall into from which you need a debugger to free yourself. At my current job I write C++ and I use a debugger practically every day. My previous job was all Python and I reached for pdb maybe 3 times in 4 years.
- hartror 16y agoI do find I use it reasonably often but have never reached for the documentation once. Which speaks to the intuitiveness of pdb as much as my experience with living in gdb when coding in C++. I love using pdb when debugging django test cases find it faster than using prints all over the place.
- mclin 16y agoOr if you use PyDev for Eclipse: import pydevd; pydevd.settrace('192.168.xxx.xxx') Same kind of thing, but with full debug UI, and you can debug remote processes, eg behind apache!
- rarrrrrr 16y agoI prefer http://winpdb.org/ http://winpdb.org/ (Not windows only.) The debugger runs as a full screen GUI app, which you attach via sockets to a running process, so you can easily debug stuff like FCGIs on other machines, etc.
- bcl 16y agoThere is also a fairly useful debug module named epdb from the guys at rpath. It opens up a port and lets you netcat to it and debug remotely. This is great for running things in a virt and being able to actually cut and paste to the debug session. http://bitbucket.org/rpathsync/epdb http://bitbucket.org/rpathsync/epdb
- MOdMac 16y agoipdb lets you use pdb in a ipython shell which makes it much more powerful. http://pypi.python.org/pypi/ipdb http://pypi.python.org/pypi/ipdb
- nailer 16y agoI hate 'me too' comments but IPDB IS A GODSEND. Once you use it you will: * Wonder how you ever did without it * Wonder why on earth it's not a standard part of Python * Free your code of crappy conditional debug prints forever * Take ipdb to bed and cuddle it at night Just: import ipdb Then where you'd like to start debugging: ipdb.set_trace() Type 'help' for help.
- kqueue 16y agoI still prefer prints
- simplegeek 16y agoHas anyone had any success with any Python debugger to debug multi-threaded programs? Just asking out of curiosity.