The following snippet bothers me. Run from the command line OK, from within Zope :- File not found ??? In my sitecustomize.py file I have appended the font directory to pythons path "C:\\py21\\fonts\\100". I did this both for my python2.1 executable and the zope python executable. I checked sys.path it has been appended. Yet run the snippet from python the font file is found, but as an external method it is not ??? OF COURSE I tried hard coding the path but all I get is ERROR: no font glyph file found :( { import Image, ImageDraw, ImageFont myfont = ImageFont.load_path("Arial Narrow Bold_18_100.pil") white = (255,255,255) black = (0,0,0) image = Image.new('RGB',(100,36),white) draw = ImageDraw.Draw(image) draw.text((0,4),'chris', fill=black, font=myfont) } What am I missing ??? Thanks in advance Chris
At last, someone else to hassle the powers that be (PythonWare). I've tried this so many times, and *never* got the fonts to load. It works fine on *nix, but doesn't work at all on Win32 afaics. If you do have any luck, please let me know what you did. tia Phil ----- Original Message ----- From: "Chris Fenton" <chrisf@fagmed.uit.no> To: <zope@zope.org> Sent: Thursday, October 11, 2001 12:34 PM Subject: [Zope] How to load PIL fonts
The following snippet bothers me. Run from the command line OK, from within Zope :- File not found ???
In my sitecustomize.py file I have appended the font directory to pythons path "C:\\py21\\fonts\\100". I did this both for my python2.1 executable and the zope python executable. I checked sys.path it has been appended. Yet run the snippet from python the font file is found, but as an external method it is not ??? OF COURSE I tried hard coding the path but all I get is ERROR: no font glyph file found :(
{ import Image, ImageDraw, ImageFont myfont = ImageFont.load_path("Arial Narrow Bold_18_100.pil") white = (255,255,255) black = (0,0,0) image = Image.new('RGB',(100,36),white) draw = ImageDraw.Draw(image) draw.text((0,4),'chris', fill=black, font=myfont) }
What am I missing ???
Thanks in advance Chris
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
[Chris Fenton]
The following snippet bothers me. Run from the command line OK, from within Zope :- File not found ???
In my sitecustomize.py file I have appended the font directory to pythons path "C:\\py21\\fonts\\100". I did this both for my python2.1 executable and the zope python executable. I checked sys.path it has been appended. Yet run the snippet from python the font file is found, but as an external method it is not ???
Here's something that has bitten me several times and may be the cause here. When you run it "externally", you are probably using an ordinary Python installation, not Zope's. Zope uses its own, and no matter what sys.path you may have set for the Python installation, the Zope version won't know about it. For example, I use .pth files to set Python's path. I have to copy them to Zope's Python directory for Zope to find them. The same applies for the location of binaries that Python finds because they are in the Python tree. You have to copy them to corresponding places in the Zope Python tree or Zope won't find them. Anything that is in the environment or in operating system paths, Zope ought to be able to find as well as the regular Python interpreter, but not the others. Give it a try. Cheers, Tom P
participants (3)
-
Chris Fenton -
Phil Harris -
Thomas B. Passin