In article <[EMAIL PROTECTED]>,
"Philippe C. Martin" <[EMAIL PROTECTED]> wrote:
>Hi,
>
>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:
try:
...code to protect...
except (SystemExit, KeyboardInterrupt):
raise
except Exception, e:
traceback.print_exc(file=sys.stderr)
....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
--
http://mail.python.org/mailman/listinfo/python-list