tags:

views:

47

answers:

2

The I/O error errno 5 are thrown when "print" is used. I don't know why??

server: redHat

A: 

With the built=in web server you can "print" and the output goes to console. If you use GAE instead, it redirects stdout to the socket so in effect you'd print on the page itself you are generating and this will break your pages. If you use mod_wsgi stdout is closed and you cannot "print" at all. I do not know what error 5 is but it may a consequence of one these issues.

My advice is DO NOT USE print for debugging. Use logging instead.

If you post web2py-related questions on the web2py mailing list you are guaranteed a response and a much faster response time.

mdipierro
For mod_wsgi it is not as simple as stdout being closed. Read 'http://blog.dscpl.com.au/2009/04/wsgi-and-printing-to-standard-output.html'.
Graham Dumpleton
A: 

You can use the following code to re-assign stdout. In effect all print statements will output to the web server's error log.

import sys

sys.stdout = sys.stderr

Tamas