ramkrishanbhatt / modwsgi

Automatically exported from code.google.com/p/modwsgi
0 stars 0 forks source link

Writing to stdout should not throw an exception #156

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Currently, when running a WSGI application, an exception is thrown if the 
application tries to write 
to stdout.

To me, this seems like undesirable behavior.

Yes, the application *shouldn't* be writing to stdout, but it seems to me like 
causing a "500 Internal 
Error" is a fairly harsh punishment for the poor developer who accidentally 
left an errant 'print' in 
their code.

Would it be appropriate to redirect stdout to stderr by default? And maybe 
print a scary warning 
there about the dangers of writing to stdout?

Original issue reported on code.google.com by wole...@gmail.com on 15 Sep 2009 at 10:14

GoogleCodeExporter commented 8 years ago
Read:

  http://blog.dscpl.com.au/2009/04/wsgi-and-printing-to-standard-output.html

Because programmers do have a tendency to be lazy and don't care about WSGI 
portability, it is already switched 
around in mod_wsgi 3.0.

Also read the mod_wsgi documentation which explains exactly how to avoid the 
problem:

  http://code.google.com/p/modwsgi/wiki/ApplicationIssues#Writing_To_Standard_Output

Original comment by Graham.Dumpleton@gmail.com on 15 Sep 2009 at 11:10

GoogleCodeExporter commented 8 years ago
Thanks for the quick reply, Graham.

I'm sorry for missing your blog post – I didn't know this was an issue 
surrounded by such strong feelings.

Anyway, I'm glad 3.0 has safer defaults, and I'll pipe down about the 2.X 
settings now.

Original comment by wole...@gmail.com on 15 Sep 2009 at 11:44