Comment 5 for bug 979598

Revision history for this message
Marco Lui (saffsd) wrote :

Thanks for that. I figured that it was a strange behavior on cgitb's behalf, and I was curious to see what you guys thought. Good to know that according to standards it's cgitb that's broken. I wonder what CGI gateways actually allow HTML comments before headers are received - that's the only way cgitb's approach could work.

In any case, the workaround involving ensuring headers are printed and warnings are suppressed is usable. For future reference, suppress the deprecation warnings with
import warnings;warnings.filterwarnings("ignore",category=DeprecationWarning)
One thing to note is that the warnings.catch_warnings context manager is ineffective - I expect that this is a threading issue?

Another option is to invoke cgitb.enable(format="text"), which causes cgitb to produce text-only output, which is however unreadable in the browser - view source is usable though. IVLE's rendering of exceptions after bytes have been written shares the same problem, as the exception is written without any formatting.

Thanks for your comments!