[Tutor] python exceptions

John Fouhy john at fouhy.net
Mon Nov 27 01:17:57 CET 2006

On 27/11/06, johnf <jfabiani at yolo.com> wrote:
> I can but it's not the issue - I think?  I want to know how it works -
> exceptions not handled by python that is.  Are there exception handled
> outside of python when using modules such as wxPython and pyQT?  Or are some
> exceptions not handled when running from the command line.

If your GUI callbacks raise exceptions, the program may still function

eg, basic Tkinter example (my Tkinter is a little rusty, so forgive errors):

e = Entry(parent)

def clear():
    e.delete(0, END)
    raise ValueError

b = Button(parent, label='Clear', command=clear)

The button will (I think) work correctly, and the program won't crash.
 But you should see the exception printed to the command line (if you
run this program from a shell).  I don't know for sure, but I imagine
the Tkinter mainloop() does something like:

    # print trace to stderr

This is the only possibility I can think of at the moment.  But there
could be other things going on, which is why we'd like to see an


More information about the Tutor mailing list