[Pythonmac-SIG] Py2app PIL recipe

Ronald Oussoren ronaldoussoren at mac.com
Tue Nov 24 11:02:56 CET 2009


On 2 Nov, 2009, at 20:10, Christopher Barker wrote:

> 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

I will commit this patch once py2apps repository gets back (I have connectivity problems to the repo at the moment)

> 
> 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?

I don't know, I don't even know which name is the preferred one. The PIL Handbook (<http://www.pythonware.com/library/pil/handbook/index.htm>) uses 'import Image' throughout.

Ronald
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3567 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/pythonmac-sig/attachments/20091124/6a8cc763/attachment.bin>


More information about the Pythonmac-SIG mailing list