[Pythonmac-SIG] py2app and PIL question

Bob Ippolito bob at redivi.com
Wed Nov 16 23:14:19 CET 2005


On Nov 16, 2005, at 2:03 PM, Chris Jerdonek wrote:

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

no, there isn't really a way to find out what data files you're using  
other than to look hard at the source code.. unless you ktrace the  
process and look at all the NAMI or something.

The code you're looking at isn't _imagingft, it's a stub to load it.   
_imagingft is an extension, written in C.

-bob



More information about the Pythonmac-SIG mailing list