Fixing common Plone errors
This article help solving common Plone problems.
Add JPEG et PNG support to Plone
This fix is tested on:
- Plone 4.1.3
In some cases, Pillow installation (image manipulation library) does not detect the libraries needed to process PNG and JPEG files. This problem trigger the error bellow:
2012-01-02T19:18:20 ERROR root could not scale "<Field image(image:rw)>" of 'http://howto.biapy.com/fr/debian-gnu-linux/applications-web/statistiques/installer-loutil-danalyse-web-piwik-sur-debian'
Traceback (most recent call last):
File "/usr/local/Plone/buildout-cache/eggs/plone.app.imaging-1.0.5-py2.6.egg/plone/app/imaging/scaling.py", line 98, in create
return create(self.context, direction=direction, **parameters)
File "/usr/local/Plone/buildout-cache/eggs/plone.app.blob-1.5.1-py2.6.egg/plone/app/blob/scale.py", line 77, in create
result=result, **parameters)
File "/usr/local/Plone/buildout-cache/eggs/plone.scale-1.2.2-py2.6.egg/plone/scale/scale.py", line 50, in scaleImage
image=PIL.Image.open(image)
File "/usr/local/Plone/buildout-cache/eggs/Pillow-1.7.5-py2.6-linux-x86_64.egg/PIL/Image.py", line 1980, in open
raise IOError("cannot identify image file")
IOError: cannot identify image file
You can also identify the problem at Pillow install during Plone buildout, when this information is displayed:
--------------------------------------------------------------------
SETUP SUMMARY (Pillow 1.7.5 / PIL 1.1.7)
--------------------------------------------------------------------
version 1.7.5
platform linux3 2.6.7 (r267:88850, Dec 1 2011, 16:11:04)
[GCC 4.6.1]
--------------------------------------------------------------------
*** TKINTER support not available
--- JPEG support not available
--- ZLIB (PNG/ZIP) support not available
--- FREETYPE2 support not available
--- LITTLECMS support not available
--------------------------------------------------------------------
To fix the problem, change directory to the instance path.
Install Pillow dependencies:
command apt-get install zlib1g-dev libjpeg8-dev liblcms1-dev libpng12-dev
Make sure to use at least Pillow version 1.7.5:
command sed -i -e 's/Pillow =.*/Pillow = 1.7.5/' 'buildout.cfg'
Remove Pillow build cache:
command rm -r /usr/local/Plone/buildout-cache/eggs/Pillow-*
Run the buildout:
su plone -c "./bin/buildout"
Restart the clients:
./bin/client1 restart
Fix the translation compilation warnings at Zope / Plone start
This fix is tested on:
- Plone 4.1.3
Under certain conditions, the translations of a Plone site may be incomplete. This is sometimes due to permission problems. This article shows how to fix the translations.
The translations of products installed by buildout are missing and one of these errors show in zope logs at instance start:
WARNING zope.i18n Error while compiling /usr/local/Plone/buildout-cache/eggs/collective.dancing-0.9.9-py2.6.egg/collective/dancing/locales/en/LC_MESSAGES/collective.dancing.po
WARNING PlacelessTranslationService Error while compiling /usr/local/Plone/buildout-cache/eggs/Products.CMFSquidTool-1.5.1-py2.6.egg/Products/CMFSquidTool/i18n/squidtool-de.po
It is most certainly due to a permission problem on the /usr/local/Plone/buildout-cache/eggs folder. This is caused by the run of the "buildout" command as root.
Fix the permissions:
command chown -R plone:root '/usr/local/Plone/buildout-cache/eggs'
Restart the instance to compile the missing translations (from the Zope / Plone instance folder):
./bin/client1 restart
In the future, run the buildout command with the Plone user (from the Zope / Plone instance folder):
su plone -c "./bin/buildout -n"