Terry Kerr <terry@adroitnet.com.au> wrote:
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?
You don't show us how you open the file object, f; the default is to open it is "text" mode, which is the same as binary mode on a Unix box, but *not* on Windows. Try: f = open( 'bla.gif', 'rb' ) instead of f = open( 'blah.gif', 'r' ) -- ========================================================= Tres Seaver tseaver@palladion.com 713-523-6582 Palladion Software http://www.palladion.com
participants (1)
-
Tres Seaver