[Zope] Two Pythons and PIL module newbie question..

Alberto Berti alberto@chiaroscuro.com
Fri, 13 Apr 2001 01:36:47 +0100


Chris Beaumont wrote:

> Hello,
> 
> I'm sorry to ask such a dumbish newbie question..
> 
> I am using the Zope binary release on a Debian Linux system. Debian of
> course comes with its own Python, so now there are two Pythons on my
> server box. I recently installed PIL from a .deb, and now I am finding
> that my Zope installation can't see it.
> 
> 
There' s still only one python on your debian system ! Zope uses the 
already installed version

To resolve your problem make a symlink from the Zope python's directory  
to the regular installation dir . But with PIL there is another little 
issue with Zope. Both zope and pil have an Image.py module . To resolve 
this issue you have to replace the standard (that is almost empty)  
__init__.py module in your system PIL directory with the one I append at 
the end of this mail. You can then use "import Image" in your modules to 
import the standard zope Image.py module and use "import PIL" to import 
the PIL package.

After the explanations...simply follow these steps:

1) install the PIL deb

2) save the text at the end of this mail in a file

as root in a console do

3)  run "ln -s /usr/lib/python1.5/site-packages/PIL  
/usr/lib/zope/lib/python"

to link the zope's path to the PIL directory

4) run "mv /usr/lib/python1.5/site-packages/PIL/__init__.py 
/usr/lib/python1.5/site-packages/PIL/__init__.py.old"

to keep a copy of the original file, even if it's almost empty...

5) run "cp <your saved file name> 
/usr/lib/python1.5/site-packages/PIL/__init__.py

to replace the old fake one with one usable.

6) restart zope with "/etc/init.d/zope restart"

happy hacking with the PIL and zope! :-)

azazel

####begin file
# Place this file in your PIL directory. Replace the mostly empty
# file of the same name.


import Image, ImageFile, ImageEnhance, ImageDraw,  _imaging, 
GifImagePlugin, JpegImagePlugin, PngImagePlugin, BmpImagePlugin
####end file