tkinter shell problem

Russell E. Owen no at spam.invalid
Tue Nov 30 01:32:36 CET 2004

In article <mailman.6760.1101319149.5135.python-list at>,
 "Philippe C. Martin" <philippecmartin at> wrote:

>I have the following problem:...
>If I trap (an exception), I do not get the stack dump that I which I would show.
>If I don"t trap it, then my clean up code...does not get called...
>Yet Idle manages - any clue ?

Use the traceback module. For example:

                ...code to protect...
            except (SystemExit, KeyboardInterrupt):
            except Exception, e:
                ....code to handle exception...

if you are sure none of your code can raise error exceptions that 
inherit directly from Exception, you can simplify this to one except:
    except StandardError, e:
Unfortunately, some common modules (including Tkinter) raise exceptions 
that inherit from Exception, not StandardError.

-- Russell

More information about the Python-list mailing list