Re: an idea: "letter bombs"

Guido.van.Rossum@cwi.nl
Fri, 17 Dec 1993 11:13:43 +0100

> Then I read my own words, and a thought hit me: __THERE'S__ a feature I'd
> desperately love to see built into Python. Howabout if, by default, the
> error message printed when Python exits due to an unhandled exception looked
> like a standard Unix error message, after the fashion of perror(3)? If you
> want it to send out the full debugging stack trace, perhaps a command-line
> arg could restore the current behavior? Maybe -D?

You can almost do this by catching IOError and os.error, except that
the exception does not include the name of the offending file. But,
of course, this might be fixed (although it's tedious work since
millions of places in the source have to be updated, and there isn't
always an obvious filename associated with an error).

Regarding the suppression of stack traces: how about a "production
code" flag (say -p) instead of a "debugging mode" flag? I think the
default behaviour should continue to give as much help in debugging as
possible -- after all not all errors are easily reproduced, yet a
glance at the stack trace will often give the author of the code an
idea of what went wrong. Also I suspect that most python invocations
are for scripts still being debugged :-)

The -p could be placed after the interpreter name on the #! line at
the beginning of the script. (Most kernels support one word of flags
here.) To run the script with debugging enabled, simply call the
interpreter explicitly with the script file as first argument.

--Guido van Rossum, CWI, Amsterdam <Guido.van.Rossum@cwi.nl>