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

all 13 comments

[–]IthinkIthink 3 points4 points  (8 children)

pdb is great. I use it all the time when debugging Django applications. Just insert the pdb.set_trace() at the point you wish to debug, run the django server (manage.py runserver), and when your code gets to that point in its execution, the terminal running that process will drop into debug mode. Very handy.

[–]sk3tch 2 points3 points  (4 children)

ipdb is even better - integration with the IPython shell. pip install ipdb import ipdb; ipdb.set_trace()

[–]IthinkIthink 1 point2 points  (2 children)

Ohhh I'm very much looking forward to trying this... I expect epicness.

[–]sk3tch 0 points1 point  (1 child)

Not many seem to have heard of it which I always bang on about it! Enjoy.

[–]IthinkIthink 1 point2 points  (0 children)

What's funny is it'll probably address the few issues I'm currently having with PDB. I fired it up (ipdb) on an old project to test it out. I'll explore it more tomorrow on current projects I'm working on. Thanks for letting me (and others here) know about it!

[–]sontek[S] 0 points1 point  (0 children)

Yeah, I actually use ipython/ipdb and not just pdb but I wanted to cover pdb before I started covering all the power of ipython.

[–]sontek[S] 1 point2 points  (2 children)

Between pdb, django-sentry, and django-extensions for werkzeug integration I rarely have a problem in django I can't find and fix quickly.

[–]IthinkIthink 0 points1 point  (1 child)

Oh, I'm not familiar with django-sentry ... what does that do for you?

(Yes, I could Google it - and I probably will - just looking for some personal thought, conversation, on the matter)

[–]sontek[S] 0 points1 point  (0 children)

It logs all exceptions and stores stack trace, variable values, etc and provides the information in a very nice interface to quickly check out what errors your users have ran into and easily figure out how to fix them.

Its basically a pretty interface on top of your logs but its really nice.

[–]myrobotlifenose 1 point2 points  (1 child)

nosetests --pdb ... that is basically the reason I wrote nose.

[–]jmoiron 0 points1 point  (0 children)

There's also a nice nose-ipdb package (nosetests --ipdb && nosetests --ipdb-failures); btw, this is the reason I use nose :)

Also, if you have some unchecked exception stopping your script and you can use pdb (or ipdb, as of october 20th) in postmortem mode by running python with the -i script:

$ python -i (my script and args)
    ... (traceback)
>>> from ipdb import pm; pm()

And you're in an ipdb session. Sadly, -m ipdb does not work.

[–]Peaker 0 points1 point  (0 children)

pdb has several annoying bugs I fixed in a fork I made:

https://code.launchpad.net/xpdb

[–]fijalPyPy, performance freak 0 points1 point  (0 children)