[Pythonmac-SIG] py2app & PIL

Christopher Barker Chris.Barker at noaa.gov
Mon Jul 14 21:27:13 CEST 2008


Mariano Di Felice wrote:
> I compile this app in my minimac with Lepard 10.5.4 OS, and I use 
> python2.5 and PIL 1.1.6 compiled from source

this can be tricky to get right, on both counts.

I'd try using the Python.org binary and...

> I've tried install ready dmg PIL from here ( 
> http://pythonmac.org/packages/py25-fat/dmg/PIL-1.1.6-py2.5-macosx10.4-2007-05-18.dmg 
> ), but I obtain a strange error FT_Load_Glyph....

well, yes, that one.

That error sounds a bit familiar -- try deleting "build" and "dist", and 
making sure all traces of your hand-build PIL are gone, and try again.

Also make sure you're using the latest Py2app and modulegraph

For the record, with:
OS-X 10.4.11 PPC
python.org python2.5.2
PIL-1.1.6 from pythonmacorg/packages
Py2app '0.3.6'
modulegraph '0.7.1'

this simple script:

import sys
from PIL import Image, ImageFont, ImageDraw

for filename in sys.argv[1:]:
     print "Processing:", filename
     im = Image.open(filename)
     print "It is a %s, %s, %s image"%(im.format, im.size, im.mode)
     print "writing out a version with some text on it:"
     draw = ImageDraw.Draw(im)
     font = ImageFont.truetype("veraBd.ttf", 15)
     draw.text((10, 20), "WaterMark", font=font)

     outfilename = filename[:-3] + "watermarked.jpg"
     im.save(outfilename)


and this setup.py:


from setuptools import setup

APP = ['SimplePILTest.py']
DATA_FILES = ["VeraBd.ttf"]
OPTIONS = {'argv_emulation': True}

setup(
     app=APP,
     data_files=DATA_FILES,
     options={'py2app': OPTIONS},
     setup_requires=['py2app'],
)


py2app works fine for me.

-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


More information about the Pythonmac-SIG mailing list