I didn't include the stacktrace procedure. I added it at the end of this
message just in case...
In a previous message I was talking about KeyboardInterrupt. The only reason
I *have* to catch it, is because it prints a stacktrace. Soooo, here is at
least one exception where it is an absolute pain in the behind to have a
stacktrace in an end user program.
However, I would hate to see all kinds of special cases depending on the
type of exception etc. etc. And except for the KeyboardInterrupt, which is
unpredictable, most other exceptions are predictable and therefore easier to
catch and convert to something you like.
------- Function Stacktrace
if tb: last_file = StackTrace(tb.tb_next)
file = tb.tb_frame.f_code.co_filename
line = tb.tb_frame.f_lineno
if file != last_file:
if file[-3:] == '.py':
module = os.path.split(file)[:-3]
sys.stderr.write('\n Module ' + `module`)
sys.stderr.write('\n File ' + `file`)
sys.stderr.write(': line ' + `line`)
sys.stderr.write(', line ' + `line`)