wongobongo wrote:
> I have been using simple print statements to help with my debugging
> and over the weekend they came back to haunt me when I tried to deploy
> the beta app using Apache and mod_wsgi. I loaded my app, which works
> fine using Paster, and Apache displayed a HTTP 500 error. A quick
> check of the Apache error log revealed:
> 
> IOError: sys.stdout access restricted by mod_wsgi
> 
> I asked the gurus at the mod_wsgi group and they pointed out that
> printing to stdout is bad form. Apparently it could confuse some
> servers that use CGI or something.
> 
> So now, I'm working through my code pulling out the print statements.
> Not a huge deal, but a hassle. Paster did not complain at all so I
> just assumed that it would discard the print output when I loaded it
> on Apache. Not so.

You can also use the paste.debug.prints middleware, which will catch all 
your prints and turn them into messages on each page.  Which is perhaps 
harder to ignore than console messages ;)

Personally I think mod_wsgi should redirect stdout to the error log, 
just like I assume it directs stderr.  I suppose you could also just do 
sys.stdout = sys.stderr in your code to do the same thing.

-- 
Ian Bicking | [EMAIL PROTECTED] | http://blog.ianbicking.org
             | Write code, do good | http://topp.openplans.org/careers

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to