No such file or directory: 'images/version.gif'
Traceback
2006-01-26 00:20:27 ERROR Zope Could not import Products.OFSP
Traceback (most recent call last):
File "F:\usability\Test\Plone21\Zope\lib\python\OFS\Application.py", line 695, in import_product
product=__import__(pname, global_dict, global_dict, silly)
File "F:\usability\Test\Plone21\Zope\lib\python\Products\OFSP\__init__.py", line 43, in ?
misc_={
File "F:\usability\Test\Plone21\Python\lib\site-packages\PIL\ImageFile.py", line 71, in __init__
self.fp = open(fp, "rb")
IOError: [Errno 2] No such file or directory: 'images/version.gif'
This breaks at least Zope's OFSP and SiteLog product. Broken products prevent Zope to be launched in debug mode.
Answer
Dieter Mauer gave a helpful answer at Zope mailing list
Zope has itself an "ImageFile" module.
Apparently, mistakenly, the "PIL" "ImageFile" is used instead.
And it behaves very differently.
Obviously, "PIL" is before Zope's software home in your "PYTHONPATH" (aka
"sys.path"). Try to prevent this...
Your PYTHONPATH includes Plone first, then Zope. This in incorrect order, because Zope 2.8.0+
Both Zope and PIL have module called ImageFile. ATContentTypes, thus Plone 2.1, depend on PIL.
PIL should be installed in your-python-interpreter/lib/site-packages/PIL.
In normal conditions PIL should not interfere PYTHONPATH since Python uses different look-up mechanisms for modules located in site-packages; site-packages modules work without adding them to PYTHONPATH explictly.
However, some IDEs and other tools, which allow the user to configure many different Python interpreters and PYTHONPATHS, may force site-packages included in PYTHONPATH so that it's overrides normal safe site-packages importing. Also, one might want to use different installation/configuration than one located in site-packages for PIL and thus needs put PIL to PYTHONPATH.
Solution
Easy way
Do not put your-python/site-packages/PIL to PYTHONPATH. Python interpreter should find these files without PIL in PYTHONPATH, if proper importing is used and there is no collision with Zope ImageFile.
Hard way
Read this if easy way failed...
Edit Zope products which include Zope's image file
Orignal:
from ImageFile import ImageFile
Modified:
from Globals import ImageFile
(don't import ImageFile module directly)
Places needing adjustment:
- Products/OFSP/__init__.py
- Products/SiteErrorLog/__init__.py
