[Zope] Create image with PIL in Zope

Bruno Miguel Silva bruno at techwave.org
Fri Oct 1 10:12:11 EDT 2004


Hi,
    I have a small script that generate a image with some text, in python with 
Python Imagin Library (PIL). 
   The problem is, i want a security image in an html page in zope, so i 
started to put the code in a External module, and now i have all kind of 
problems with that script.
   When i use the "ImageFont.load('pathToFont.pil')", that causes an
Error Type: IOError
Error Value: cannot find glyph data file
   i don' understand, because i have the ".pbm", and it works in command line.

   So, then i try to do "ImageFont.load_path('font.pil')", and that causes a
Error Type: IOError
Error Value: cannot find font file
   once again i couldn't understand because it works on command line, because 
the font file is in "/usr/lib/python2.3/site-packages/pilfonts/"

   At this time, i start to dig in the sourcecode of ImageFont.py, and i found 
that when it raises the "cannot find glyph data file", is when it try's to 
open the ".pbm" file with Image.open(), i tried to do this to get more 
information, and it gives a 
Error Type: AttributeError
Error Value: 'file' object has no attribute 'startswith'

   I don't know if this makes any sense to you, .... but are there someone to 
help me in this?
   Do i have other alternatives to generate images with text on the fly in 
zope?

thanks in advance,
--Bruno Silva


More information about the Zope mailing list