[Zope] Name Clashing between Zope and PIL
The Dragon De Monsyne
dragondm@delta.integral.org
Thu, 11 Feb 1999 23:02:13 -0600 (CST)
On Thu, 11 Feb 1999, Michel Pelletier wrote:
> > Hello,
> >
> >
> > There seems to be a name-clashing between zope and PIL
> > library, namely the
> > module 'ImageFile'.
> > Did someone encoutner this problem, and how is the suggested way of
> > solving it?
> >
> Yes, it was discussed on the list a few weeks ago, while
> we were in the midst of moving-office-hell. I suggest
> before re-opening this wound we (those of us who are
> interested) go back and read the relevant discussions
> so we don't reproduce non-productive discussion.
>
> -Michel
I have a patch for the PIL that solves this problem. It does _not_
interfere with the 'standard' use of the PIL at all, but it allows for it
to me imported as a package (named PIL) as well as by the 'standard'
method. The patch is very simple, basically just adding an empty
__init__.py to the PIL directory, and patching two __import__() calls in
Image.py so the plugins get imported with the right context.
Here's the diffs on Image.py:
----Begin diff
*** Image.py.orig Thu Feb 11 10:21:12 1999
--- Image.py Sun Feb 7 10:39:02 1999
***************
*** 146,152 ****
for m in ("BmpImagePlugin", "GifImagePlugin", "JpegImagePlugin",
"PpmImagePlugin", "TiffImagePlugin"):
try:
! __import__(m)
except ImportError:
pass # ignore missing driver for now
--- 146,152 ----
for m in ("BmpImagePlugin", "GifImagePlugin", "JpegImagePlugin",
"PpmImagePlugin", "TiffImagePlugin"):
try:
! __import__(m, globals(), locals(), [])
except ImportError:
pass # ignore missing driver for now
***************
*** 170,176 ****
try:
sys.path.insert(0, path)
try:
! __import__(f)
finally:
del sys.path[0]
except ImportError:
--- 170,176 ----
try:
sys.path.insert(0, path)
try:
! __import__(f,globals(), locals(), [])
finally:
del sys.path[0]
except ImportError:
----End diff
-The Dragon De Monsyne