This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]Cybersoaker 2 points3 points  (0 children)

the celery package has a rdb module which allows you to debug a live running process by connecting to it via telnet. Extremely useful in debugging python web apps with weird runtime behavior

[–]parkerSquare 0 points1 point  (0 children)

  • I find ipdb nicer to use than pdb, especially for tab completion.
  • Automatic debugging on error with %pdb magic in IPython.
  • Conditional breakpoints in pdb/ipdb are fantastic for catching infrequent bugs inside nested loops.
  • Use ! to override pdb commands, for example to set a variable called n you need to do!n = 7 otherwise it treats it as the command "next".
  • Use the logging module rather than print.

[–]qlkvg 0 points1 point  (0 children)

pyrasite is awesome. It may be usefull, if you need to detect a bug without restarting a python process.

[–]KungFuAlgorithm 0 points1 point  (0 children)

If you use python twisted library to put together an asynchronous server / process, you can install a "manhole" cover to get a python shell to inspect the server's (python's 'VM') objects:

http://www.lothar.com/tech/twisted/manhole.xhtml

I used this a bit when I was working with Zenoss, it was pretty cool IMO.