Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

wsgi.errors: str object has no attribute write #16

Open
vectart opened this Issue Jun 30, 2010 · 9 comments

Comments

Projects
None yet
3 participants

vectart commented Jun 30, 2010

Today I'm update my Debian server and got the error:

Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.6/web/wsgiserver/__init__.py", line 1174, in communicate
    req.respond()
  File "/usr/lib/pymodules/python2.6/web/wsgiserver/__init__.py", line 544, in respond
    self._respond()
  File "/usr/lib/pymodules/python2.6/web/wsgiserver/__init__.py", line 556, in _respond
    response = self.wsgi_app(self.environ, self.start_response)
  File "/usr/lib/pymodules/python2.6/web/httpserver.py", line 237, in __call__
    return self.app(environ, xstart_response)
  File "/usr/lib/pymodules/python2.6/web/httpserver.py", line 212, in __call__
    return self.app(environ, start_response)
  File "/usr/lib/pymodules/python2.6/web/httpserver.py", line 237, in __call__
    return self.app(environ, xstart_response)
  File "/usr/lib/pymodules/python2.6/web/application.py", line 293, in wsgi
    start_resp(status, headers)
  File "/usr/lib/pymodules/python2.6/web/httpserver.py", line 233, in xstart_response
    out = start_response(status, response_headers, *args)
  File "/usr/lib/pymodules/python2.6/web/httpserver.py", line 234, in xstart_response
    self.log(status, environ)
  File "/usr/lib/pymodules/python2.6/web/httpserver.py", line 251, in log
    print >> outfile, utils.safestr(msg)
AttributeError: 'str' object has no attribute 'write'

It's just when I run application.
When I'm use request emulation, it's okay.

Contributor

anandology commented Aug 30, 2010

Can you provide a sample program to reproduce the error?

vectart commented Sep 3, 2010

Okay, I'll try

vectart commented Sep 27, 2010

Reproduced

2010-09-27 13:14:08: (mod_fastcgi.c.2711) FastCGI-stderr: Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.6/flup/server/fcgi_base.py", line 558, in run
    protocolStatus, appStatus = self.server.handler(self)
  File "/usr/lib/pymodules/python2.6/flup/server/fcgi_base.py", line 1118, in handler
    result = self.application(environ, start_response)
  File "/usr/lib/pymodules/python2.6/web/application.py", line 282, in wsgi
    result = self.handle_with_processors()
  File "/usr/lib/pymodules/python2.6/web/application.py", line 252, in handle_with_processors
    return process(self.processors)
  File "/usr/lib/pymodules/python2.6/web/application.py", line 248, in process
    print >> web.debug, traceback.format_exc()
  File "/usr/lib/pymodules/python2.6/web/webapi.py", line 339, in _debugwrite
    out.write(x)
AttributeError: 'str' object has no attribute 'write'

vectart commented Sep 27, 2010

And when I'm run application as stand-alone server I have another log

Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.6/web/wsgiserver/__init__.py", line 1174, in communicate
    req.respond()
  File "/usr/lib/pymodules/python2.6/web/wsgiserver/__init__.py", line 544, in respond
    self._respond()
  File "/usr/lib/pymodules/python2.6/web/wsgiserver/__init__.py", line 556, in _respond
    response = self.wsgi_app(self.environ, self.start_response)
  File "/usr/lib/pymodules/python2.6/web/httpserver.py", line 237, in __call__
    return self.app(environ, xstart_response)
  File "/usr/lib/pymodules/python2.6/web/httpserver.py", line 212, in __call__
    return self.app(environ, start_response)
  File "/usr/lib/pymodules/python2.6/web/application.py", line 282, in wsgi
    result = self.handle_with_processors()
  File "/usr/lib/pymodules/python2.6/web/application.py", line 252, in handle_with_processors
    return process(self.processors)
  File "/usr/lib/pymodules/python2.6/web/application.py", line 248, in process
    print >> web.debug, traceback.format_exc()
  File "/usr/lib/pymodules/python2.6/web/webapi.py", line 339, in _debugwrite
    out.write(x)
AttributeError: 'str' object has no attribute 'write'

vectart commented Sep 27, 2010

So if you'll needed I can open my github-repo with the buggy code.

Contributor

anandology commented Sep 27, 2010

can you please attach a sample program to reproduce that?

vectart commented Sep 27, 2010

It's more than just simple program :-)

I was give access for you at
https://github.com/vectart/homepage

For run it, ubuntu packages needed to install:
python-redis redis-server python-utidylib python-zsi
and http://code.google.com/p/py-dom-xpath/

File homepage.conf describe host configuration for Lighttpd
But also you can just run
run.py

Thanks you for the interest to solve that bug!

Contributor

anandology commented Nov 10, 2010

Are you setting web.debug = False instead of web.config.debug = False anywhere?

Did you ever figure out the cause? I run a little web.py/redis-backed site and am experiencing the same error. If I restart both processes, things run smoothly for a while and then every request begins to error out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment