Open GoogleCodeExporter opened 9 years ago
There is a current implemented workaround in Pinax, see
pinax/projects/complete_project/deploy/complete_project.wsgi
{{{
# redirect sys.stdout to sys.stderr for bad libraries like geopy that uses
# print statements for optional import exceptions.
sys.stdout = sys.stderr
}}}
Original comment by ingenier...@gmail.com
on 4 Feb 2009 at 10:28
The WSGI specification doesn't disallow using 'print' but mod_wsgi places
restrictions on doing so to promote
portable WSGI applications. Specifically, certain WSGI adapters such as those
for CGI, use stdin/stdout to
communicate with the server. Thus, using 'print' in that case will cause debug
messages to get mixed up in
response output.
Although reassigning sys.stdout to sys.stderr can be used in the WSGI script
file for mod_wsgi, it is
discouraged. The original package which is producing debug output, should be
use sys.stderr explicitly and
not sys.stdout implicitly.
Thus, package should use:
print >> sys.stderr, "some debug"
That or use proper logging system.
Original comment by Graham.Dumpleton@gmail.com
on 5 Feb 2009 at 3:05
I am in agreement with Graham. The external library *should* be fixed. However,
unfortunately we don't have
direct access to it, but we could fork it. As ingenieroariel pointed out we do
work around this by redirecting
sys.stdout to sys.stderr which as pointed out is really discouraged and I am
not happy with it.
One of the things we want to do before we hit a 1.0 is fix issues like this.
However, the original report is
incorrect in that if you are seeing the exception about not being allowed to
write to sysout in mod_wsgi then
*you* are doing something wrong. I am going to adjust the title to reflect the
real issue here.
Original comment by bros...@gmail.com
on 5 Feb 2009 at 3:29
Original comment by bros...@gmail.com
on 5 Feb 2009 at 3:30
Original comment by jtau...@gmail.com
on 16 Mar 2009 at 3:07
Original issue reported on code.google.com by
Chris.Sh...@gmail.com
on 4 Feb 2009 at 9:55