[Baypiggies] Possible future meeting topic

Benjamin Sergeant bsergean at gmail.com
Thu Nov 6 23:09:32 CET 2008


On Sat, Nov 1, 2008 at 1:26 AM, Shannon -jj Behrens <jjinux at gmail.com>wrote:

> On Wed, Oct 29, 2008 at 10:07 AM, Fernando Perez <fperez.net at gmail.com>
> wrote:
> > On Wed, Oct 29, 2008 at 2:00 AM, Shannon -jj Behrens <jjinux at gmail.com>
> wrote:
> >
> >> Coding in the shell is great, but sometimes coding in the debugger is
> >> like coding in the shell but with all the setup already taken care of
> >> ;)  It's a good trick when you want to code in the shell, but you're
> >> writing a Web app that requires a full request, etc. and you need to
> >> "look around" at all the data in the environ to figure out what to do.
> >>  2 minutes looking around in pdb saves 20 minutes looking through
> >> middleware documentation ;)
> >
> > +1.  One of my favorite approaches is to simply drop an explicit
> >
> > 1/0
> >
> > at the point in the code where I want to go rooting around.  Then run
> > the code (I'm obviously always working in ipython :) and type %debug
> > after the exception blows up.  This opens up a slightly nicer pdb
> > (with coloring and all-important tab completion), and I often find
> > what I need that way very quickly.
> >
> > If you like this approach, for cases with more complex logic you may
> > find the embedded ipython trick useful:
> >
> >
> http://ipython.scipy.org/doc/manual/html/interactive/reference.html#embedding-ipython
> >
> > One line of code and you have a full-blown ipython open at any point
> > inside your code.
> >
> > Cheers,
>
> I think you should cover this at the talk ;)
>
> I use "import pdb; pdb.set_trace()", but since I already use IPython,
> I'd love to hear more about %debug.
>


I just tried to sneak
"import pdb; pdb.set_trace()"
in some google app engine code (app, not core) and it didn't work (was
trying to use bdb I think, which is one of the fordidden module ?).

In a talk on pdb, I think a slide with limitations/tricks would be nice. For
example I use that for debuging pyqt apps.

It you see the following message when debuging with pdb:

    Flood message: "QCoreApplication::exec: The event loop is already
running"

Use this pyqt call before:

    from PyQt4 import QtCore, QtGui, QtOpenGL
    QtCore.pyqtRemoveInputHook()

- Benjamin



>
> -jj
>
> --
> The safest way to do multithreaded programming is to put each thread
> in its own process ;)
> http://jjinux.blogspot.com/
> _______________________________________________
> Baypiggies mailing list
> Baypiggies at python.org
> To change your subscription options or unsubscribe:
> http://mail.python.org/mailman/listinfo/baypiggies
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/baypiggies/attachments/20081106/9162d37c/attachment.htm>


More information about the Baypiggies mailing list