John Ziniti wrote at 2004-7-6 20:44 -0400:
... 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 ImageFile.py that comes with PIL. This causes lots of hard-to-track errors that have "weird" error messages ( I always get "BadFont" ).
I do not think this is a Zope fault... We can use Zope and PIL together without any problem and without the need to change either Zope nor PIL.
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/JpegImagePlugin.py to read:
from PIL import ImageFile
Provided that "PIL.JpegImagePlugin" was imported via the "PIL" package, "import ImageFile" will work as well -- without any danger to clash with any other "ImageFile"... The problem almost surely is that PIL provides for accessing PIL modules without going through the PIL package *AND* your application makes use of this possibility. Always access PIL modules in your application code via "PIL.module" and never via "module". -- Dieter