Today I did a svn up (I'm now at revision 2012) to test my application
with the new and shiny cherrypy.
But when I try to contact the server I've got the following tracebacks
in the browser:
File "/home/nicoe/python/cherrypy/wsgiserver/__init__.py", line 983, in communicate
req.parse_request()
File "/home/nicoe/python/cherrypy/wsgiserver/__init__.py", line 304, in parse_request
self._parse_request()
File "/home/nicoe/python/cherrypy/wsgiserver/__init__.py", line 317, in _parse_request
request_line = self.rfile.readline()
File "/home/nicoe/python/cherrypy/wsgiserver/__init__.py", line 212, in readline
data = self.rfile.readline(256)
File "/home/nicoe/python/cherrypy/wsgiserver/__init__.py", line 823, in readline
nl = data.find('\n', 0, size)
AttributeError: 'cStringIO.StringO' object has no attribute 'find'
Does anybody knows what can cause this bug ?
--
(°> Nicolas Évrard
/ ) Liège - Belgique
^^
You're using a new version of Python and they changed the way to buffer
the read input in socket._fileobject. At least up to Python 2.5.x they
were using a string. They moved to a StringIO object.
http://svn.python.org/view/python/trunk/Lib/socket.py?rev=63788&view=markup
Look at the __init__() method of socket._fileobject.
The problem is that CherryPy inherits from socket._fileobject and
overwrites some of the methods like readline(). The subclass therefore
expects self._rbug to be a string, not a StringIO.
I don't know how Robert would like to handle that case (probably a huge if
on the Python version and have two distinct CP_fileobject classes.
For now your best bet is to downgrade your Python version to 2.5.2
- Sylvain
--
Sylvain Hellegouarch
http://www.defuze.org
FYI the rational behind that change:
http://svn.python.org/view?rev=62627&view=rev
They might backport it to 2.5 too eventually.
Thank you Sylvain for this quick anwser, I will use python2.4 for my
tests.
does this affect the just released CP 3.1.0?
-jim