开发者

Print statements on server give IOError: failed to write data

开发者 https://www.devze.com 2023-02-01 11:14 出处:网络
I am running Pylons on my local machine with paster, and on a Debian server using WSGI. I want to add some print statements to debug a problem: am not a Pylons or Python expert.

I am running Pylons on my local machine with paster, and on a Debian server using WSGI. I want to add some print statements to debug a problem: am not a Pylons or Python expert.

On my local machine this works开发者_如何学编程 fine: print statements go to the terminal. On the server, the statements don't print to the log files: instead the log file says "IOError: failed to write data" whenever a print statement is called.

Until I can fix this, I can't debug anything on the server.

Could someone advise how to get printing running on the server? Thanks!


It's wrong for a WSGI application to use sys.stdout or sys.stderr. If you want to spit debug to a server error log, use environ['wsgi.errors'].write().


Don't use print statements, use the logging module. We can't help you without knowing the setup of the server.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号