[Zope] reading of binary files

Jonothan Farr jfarr@real.com
Tue, 22 Feb 2000 13:46:03 -0800


Are you opening the file in "rb" mode? This is only really necessary on
Windows.

-jfarr

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Hi! I'm a signature virus.
Copy me into your .sig to join the fun!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

----- Original Message -----
From: Terry Kerr <terry@adroitnet.com.au>
To: <zope@zope.org>
Sent: Monday, February 21, 2000 8:02 PM
Subject: [Zope] reading of binary files


> Hi,
>
> I encountered this problem when my product tries to load image files
> from the local drive.  The code is below:
>
> file="blah"
> ob._setObject(file,OFS.Image.Image(file,file,"","image/gif"))
> data = f.read()
> ob._getOb(file).manage_upload(data)
>
>
> This works fine in zope under linux, but in zope under windows, the data
> is trucated.  This is a python problem in windows.  f.read() returns a
> string that is only a fraction of the length of the image file.  Is
> there a way around this problem?  Has anybody else encountered this
> problem?
>
>
>
>
> terry
>
>
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>