Tor Oskar Wilhelmsen wrote:
I'm trying to get the PIL(last version on python 2.3) working with Zope, but it seems that it's not working.
I use the code:
file = StringIO.StringIO(data)
im =
where data is datafrom a blob in a db. This code is working outside Zope, but at once when i try to make it a product in Zope, I get this error:
IOError: cannot identify image file

I've had problems using PIL-based products in Zope because Zope has its own module called "ImageFile" and Zope does some sys.path munging so that when certain PIL modules do "import ImageFile", they import the Zope version, instead of the that comes with PIL. This causes lots of hard-to-track errors that have "weird" error messages ( I always get "BadFont" ).

I have "fixed" this problem before by editing the module for
the type of image I am using to do a more explicit import.  For
example, for JPEG images, I edit PIL/ to

from PIL import ImageFile

This is at or around line 34, which reads "import ImageFile".
So, you could make the changes to the files corresponding to
the Image type you are using, then *restart Zope* (the fix
is in site-packages so a Refresh won't do it!) and then
give it a try.

I'd be happy to hear if this helps you,

John Ziniti

Zope-Dev maillist - [EMAIL PROTECTED]
** No cross posts or HTML encoding! **
(Related lists - )

Reply via email to