[Pythonmac-SIG] PIL and py2app on Leopard

Jörg Birkhold joerg.birkhold at gmail.com
Wed Apr 9 20:47:15 CEST 2008


Am 09.04.2008 um 19:22 schrieb Christopher Barker:
>>
>
>
> I've just looked at my install, which is from the PIL package on  
> pythonmac.org/packages. in site-packages, there is a directory  
> called "PIL". It is a package (it has an __init__.py), but it is  
> also added to the sys.path by the addition of a PIL.pth file. So you  
> should be able to import it either way, but perhaps "from PIL import  
> Image" is confusing py2app.


Strange thing is I downloaded the mac package from pythonmac but the  
installer says there is no python 2.5 on my system???
I'm using Leopard with Developer Tools so it is there for sure.

>>
>
> Odd -- how did you install PIL? Anyway, there should be a file in
I installed PIL from source calling setup.py, I have the package in  
site-packages but no PIL.pth.
after adding PIL.pth I can use Import Image.
1 step forward :-)

>
>
> Now on to py2app:
>
> Py2app is supposed to read your code and determine what modules/ 
> packages are needed, an include those automatically. Some packages  
> need special attention to be included correctly. PIL is one of  
> those. In this case, there are built-in "recipes" that should get  
> triggered when you use a given package, and it will do some extra  
> stuff for you. There is a PIL recipe in:
>
> /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site- 
> packages/py2app-0.4.2-py2.5.egg/py2app/recipes/PIL
yepp it is there

After fixing the PIL.pth i could generate one app where i could see  
the site-packages like PIL inside the app-package but just one time.
Now I don't even get an error the app is just crashing on startup.


>
>
> That should "do the right thing" with PIL.
>
> If it isn't working, then it's broken, and hopefully one of the  
> folks here can figure it out and fix it.
>
> So, for your situation, I recommend:
>
> 1) Get PIL installed so that "import Image" works.
>
> 2) make a little script that does little else but "import image" and  
> some little action to test it.
>
> 3) build a simple py2app setup.py, like:
>
> from setuptools import setup
>
> setup(
>   app="MyScript.py",
>   setup_requires=['py2app'],
> )

i will look into it tomorrow an try to build up everything step by step.
Is there a log or something automatically written with the python  
errors of the app? If not how can I achieve this?





>
>
> Should do it.
>
> And you might want to try it with both: "import Image" and "from PIL  
> import Image", 'cause it looks like both should work.
>
> That should "just work". If it doesn't:
>
> Report back what you get, and be sure to include:
>
> Your script
> Your setup.py
> Your OS-X version
> Your Python version (where you got it, how you installed it)
> Your py2app version
> Your PIL version (where you got it, how you installed it)
>
>

Thanks a lot so far I hope I will manage to get it running and report  
how it is going.


Joerg



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



More information about the Pythonmac-SIG mailing list