[Pythonmac-SIG] py2app and PIL question
Chris Jerdonek
jerdonek at gmail.com
Wed Nov 16 23:03:14 CET 2005
On Nov 16, 2005, at 1:38 PM, Bob Ippolito wrote:
>> File "PIL/ImageFont.pyc", line 121, in __init__
>> IOError: cannot open resource
>>
>> # Wrapper for FreeType fonts. Application code should use the
>> # <b>truetype</b> factory function to create font objects.
>>
>> class FreeTypeFont:
>> "FreeType font wrapper (requires _imagingft service)"
>>
>> def __init__(self, file, size, index=0, encoding=""):
>> # FIXME: use service provider instead
>> import _imagingft
>> (121) self.font = _imagingft.getfont(file, size, index, encoding)
>
> Looks like it's trying to find a font or something that isn't where
> PIL expects it to be... you sure you added all the data files that
> you're using?
>
> -bob
Is there a way for me to find out what data files I'm using?
Apparently the font normally gets loaded through PIL's _imagingft
module, but the _imagingft module seems weird. Take a look at it below
(it even mentions py2app). Any idea what this means -- how to work
around it?
def __load():
import imp, os, sys
ext = 'PIL/_imagingft.so'
for path in sys.path:
if not path.endswith('lib-dynload'):
continue
ext = os.path.join(path, ext)
if os.path.exists(ext):
#print "py2app extension module", __name__, "->", ext
mod = imp.load_dynamic(__name__, ext)
#mod.frozen = 1
break
else:
raise ImportError, repr(ext) + " not found"
else:
raise ImportError, "lib-dynload not found"
__load()
del __load
More information about the Pythonmac-SIG
mailing list