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'
> 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 ?
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.
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
> 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.
>> 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 ?
>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.
Thank you Sylvain for this quick anwser, I will use python2.4 for my tests.
On Fri, 2008-07-04 at 11:39 +0200, Sylvain Hellegouarch wrote:
> > Hello,
> > 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 ?
> 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.
> 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
Jim Jones wrote: > On Fri, 2008-07-04 at 11:39 +0200, Sylvain Hellegouarch wrote: > > > 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 ?
> > 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.
> > 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
Hi, I find out CP_fileobject.{flush|read|readline} are mostly
identical to its superclass socket._fileobject.
I tried delete these 3 methods, and got a working cherrypy on Python
2.6b1+ (trunk:64757, Jul 6 2008, 23:16:51)
Later on, I rerun the testsuite
on python 2.5.1: all tests pass
on python 2.6: only 3 tests failed.
Unfortunately I couldn't tracking down python 2.6 related problems,
please see attached logs under ticket 837 for details.
On Jul 6, 10:49 pm, "Robert Brewer" <fuman...@aminus.org> wrote:
> Jim Jones wrote:
> > On Fri, 2008-07-04 at 11:39 +0200, Sylvain Hellegouarch wrote:
> > > > 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 ?
> > > 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.
> > > 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