[Python-ideas] Structured Error Output

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Apr 26 06:04:17 CEST 2012

On 26/04/12 14:04, Bryce Boe wrote:
> Perhaps
> I am a bit optimistic that grepping for output to stderr and replacing
> the write or fprintf calls with a function call would be appropriate.

I don't see how that would solve your problem anyway. If your student's
interpreter code, written in Python, raises e.g. a TypeError, and nothing
catches it, the error message for it will get printed by the very same
printf call as any other uncaught exception.

Seems to me the solution to your problem lies in sandboxing the student's
code inside something that catches any exceptions emanating from it and
logs them in a distinctive way. You could also replace sys.stdout and
sys.stderr with objects that perform a similar function.


More information about the Python-ideas mailing list