[triangle-zpug] can't find font problem

Joseph Mack NA3T jmack at wm7d.net
Sun Mar 30 03:42:01 CEST 2008


I have a font which I can find with the full pathname

#-----code starts here
from math import sqrt
import os, sys
from PIL import Image, ImageDraw, ImageFont


print sys.path
#fonts
#THIS LINE WORKS
#label_font=ImageFont.load("/usr/lib/python2.4/site-packages/PIL/courR18.pil")
#THIS LINE FAILS
label_font=ImageFont.load("PIL/courR18.pil")
#-------code ends here


I get an error with any variation of the font filename where 
I left python handle the python path, including just the 
bare filename.

Here's python path from the code

['/src/da/python_class/class_code',
'/usr/lib/python24.zip', 
'/usr/lib/python2.4',
'/usr/lib/python2.4/plat-linux2', 
'/usr/lib/python2.4/lib-tk', 
'/usr/lib/python2.4/lib-dynload', 
'/usr/lib/python2.4/site-packages', 
'/usr/lib/python2.4/site-packages/PIL']

the error is

Traceback (most recent call last):
   File "./pi_numerical_integration_diagram.py", line 55, in ?
     label_font = ImageFont.load("PIL/courR18.pil")
   File "/usr/lib/python2.4/site-packages/PIL/ImageFont.py", 
line 180, in load
     f._load_pilfont(filename)
   File "/usr/lib/python2.4/site-packages/PIL/ImageFont.py", 
line 67, in _load_pilfont
     file = open(filename, "rb")
IOError: [Errno 2] No such file or directory: 
'PIL/courR18.pil'


I've got code that runs, but I'd like to get my python 
path working. What am I doing wrong?

Thanks Joe

-- 
Joseph Mack NA3T EME(B,D), FM05lw North Carolina
jmack (at) wm7d (dot) net - azimuthal equidistant map
generator at http://www.wm7d.net/azproj.shtml
Homepage http://www.austintek.com/ It's GNU/Linux!




More information about the TriZPUG mailing list