[Web-SIG] [WSGI] mod_python wrapper: minimal first attempt

Phillip J. Eby pje at telecommunity.com
Thu Oct 14 23:33:52 CEST 2004

At 02:20 PM 10/14/04 -0700, Robert Brewer wrote:

>   File "C:\Python23\lib\site-packages\wsgiref\handlers.py", line 325, in
>     start_response(self.error_status, self.error_headers[:])

Aha.  That's a wsgiref bug; it should be passing 'sys.exc_info()' as the 
third argument here.  As a result, it doesn't work if start_response has 
already been called.  I've fixed this in CVS now.  Apparently the tests 
don't yet cover a scenario of "call start_response(), then raise an 
exception before the headers are actually sent."

> > One quick question: what is 'sys.stderr' for Python under
> > mod_python?  If
> > it prints to the error log, there's no reason (at least from
> > a compliance
> > POV) not to simply use it as the handler's stderr.
>sys.stderr -> apache's error log. See

Ah.  So it should suffice to use sys.stderr, as long as the output is 
flushed from time to time.  I've changed wsgiref to flush stderr after 
writing exception output, since it really should be doing that for other 
platforms as well.

More information about the Web-SIG mailing list