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

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig

Reply via email to