[Python-ideas] Structured Error Output

Bryce Boe bboe at cs.ucsb.edu
Wed Apr 25 21:27:03 CEST 2012


I looked through the man page for python's interpreter and appears
that there is no way to properly distinguish between error messages
output to stderr by the interpreter and output produced the by a
user-program to stderr.

What I would really like to have are two things:

1) an option to output interpreter generated messages to a specified
file, whether these messages are uncatchable syntax errors, or
catchable runtime errors that result in the termination of the
interpreter. This feature would allow a wrapper program to distinguish
between user-output and python interpreter output.

2) an option to provide a structured error output in some common
easy-to-parse and extendable format that can be used to associate the
file, line number, error type/number in some post-processing error
handler. This feature would make the parsing of error messages more
deterministic, and would be of significant benefit if other
compilers/interpreters also provide the same functionality in the same
common format.

Does anyone know if there is already such a way to do what I've asked?
If not, do you think having such features added to python would be
something that would actually be included?

Bryce Boe

More information about the Python-ideas mailing list