[Zope3-Users] readline() takes exactly 1 argument

Christian Theune ct at gocept.com
Mon Dec 18 17:43:35 EST 2006


Hi,

George Wright wrote:
> Trying to get started on Zope3 but frustrated by a couple of barriers:
> 
> Barrier 1.
>   Added a folder. Added a ZPT Page (As in Zope3 Developer's Book page  
> 12).
> Then get system error message:
> Traceback (most recent call last):
>    Module zope.publisher.publish, line 126, in publish
>      request.processInputs()
>    Module zope.publisher.browser, line 263, in processInputs
>      fs = FieldStorage(fp=fp, environ=self._environ,  
> keep_blank_values=1)
>    Module cgi, line 530, in __init__
>      self.read_multi(environ, keep_blank_values, strict_parsing)
>    Module cgi, line 650, in read_multi
>      environ, keep_blank_values, strict_parsing)
>    Module cgi, line 532, in __init__
>      self.read_single()
>    Module cgi, line 665, in read_single
>      self.read_lines()
>    Module cgi, line 687, in read_lines
>      self.read_lines_to_outerboundary()
>    Module cgi, line 715, in read_lines_to_outerboundary
>      line = self.fp.readline(1<<16)
> TypeError: readline() takes exactly 1 argument (2 given)

This looks like a known incompatibility with Python 2.4.4. (If you're
interested in the details, see http://www.zope.org/Collectors/Zope3-dev/535)

> I did a search of archives and found references to a patch of http.py  
> and tales of success in solving the same problem:
> 
> Yes. Apply this patch to the zope3-sources:
> 
> /http.py
> --- src/zope/publisher/http.py.old 2006-10-04 15:11:04.000000000 +0200
> +++ src/zope/publisher/http.py  2006-10-04 15:11:04.000000000 +0200
> @@ -205,7 +205,7 @@
>           return data
> 
>       def readline(self,size=None):
> -        data = self.stream.readline(size)
> +        data = self.stream.readline()
>           self.cacheStream.write(data)
>           return data

This is a standard patch format and there is a utility that can apply
this patch for you automatically. The patch is made for a checkout and
maybe also works on the source distribution for Zope 3.3

You should be able to store that patch in a file, e.g. called
'patchname.patch' and then run 'patch -p0 < patchname.patch' in your
terminal. (I guess MacOS X comes with patch by default.)

Watch out for messages saying "Hunk X out of X FAILED" though.

Then reinstall your Zope server using make install, that should get your
installation directory updated with the right file.

> BUT I'm not sure what to do with it!  What do the little - and + in  
> front of the "data = " lines mean?  And the "@@ -205,7 +205,7 @@" ?
> 
> Just which http.py is to be patched?
> ~/Zope-3.3.0/build/lib.macosx-10.3-fat-2.4/zope/publisher/http.py
> OR
> ~/Zope-3.3.0/build/lib.darwin-8.8.0-Power_Macintosh-2.4/zope/ 
> publisher/http.py
> OR ?

This looks like you did 'make' in your Zope-3.3.0 directory multiple
times on different versions of your operating system. Or this is an
idiom specific to Python on Mac OS X.

> Maybe this problem has been fixed in a later version?

It's not yet fixed finally, but if you watch the bug that I posted
above, you should be able to

The bugfix release should be available in early Januar 07.

Christian

-- 
gocept gmbh & co. kg - forsterstraße 29 - 06112 halle/saale - germany
www.gocept.com - ct at gocept.com - phone +49 345 122 9889 7 -
fax +49 345 122 9889 1 - zope and plone consulting and development


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
Url : http://mail.zope.org/pipermail/zope3-users/attachments/20061218/1dace0b1/signature.bin


More information about the Zope3-users mailing list