[Pythonmac-SIG] py2app and Pyhon Imaging Library PIL
Bob Ippolito
bob at redivi.com
Fri Oct 20 20:31:35 CEST 2006
On 10/20/06, Martin Dunschen <zabaione at uk2.net> wrote:
> I had the following problem with a python script that imports the Image
> module:
>
> ...
> import Image
> ...
>
>
> When I build an app with py2app I got an error that Image can't be found.
> I tracked the problem down to the file
> MyApp.app/Contents/Resources/__boot__.py
> which imports it.
>
> In there changed the line
> import Image
> to
> from PIL import Image
>
> and also how I import Image in my own script. It works.
>
> But I don't understand why the original version does not work?
The canonical way to import PIL is "import Image" not "from PIL import
Image". You should be using "import Image" in your script.
If you use "import Image" then it should work in py2app. It works here
anyway, if it still doesn't work you're going to need to provide
enough information to reproduce the problem.
> I understand that __boot__.py in created, but is there a template I can
> change? Is that the right way to fix this problem?
__boot__ is generated from the recipes and prescripts. This line comes
from the PIL recipe.
No, that's not the right way to fix it. I don't think it's broken, anyway.
-bob
More information about the Pythonmac-SIG
mailing list