[Pythonmac-SIG] Py2app PIL recipe

Christopher Barker Chris.Barker at noaa.gov
Mon Nov 2 20:10:47 CET 2009


Hi folks,

For a while now, PIL has provided a proper package, so that you can do:

from PIL import Image

rather than relying on a pth file and:

import Image


I'm such a fanatic about "proper" use of packages and namespaces that I 
removed the PIL.pth file from my system.

Then I tried to use py2app on a program that uses PIL. It turns out that 
the PIL py2app recipe has a prescript.py file that gets put into the 
bundle, and it uses the old "import Image" form.

I've hacked it to use:

     try:
         import Image
     except ImportError:
         from PIL import Image # note: the newer way to import PIL
     import sys

instead, which works fine for me.

I'd really rather simple use the package form:

    from PIL import Image # note: the newer way to import PIL

all by itself, but there is some chance that that would break older PIL 
installations -- or is there? when was the PIL directory made a package?

Anyway, could someone with SVN access to py2app please make this small 
patch. (I've enclosed the whole file, to make it easy).

It belongs in:

py2app/recipes/PIL/prescript.py


Thanks,
-Chris





-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker at noaa.gov
-------------- next part --------------
A non-text attachment was scrubbed...
Name: prescript.py
Type: application/x-python
Size: 615 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/pythonmac-sig/attachments/20091102/11261b7a/attachment.bin>


More information about the Pythonmac-SIG mailing list