[reportlab-users] Intermittent failure to find font, followed by IOError
IStevens at globeandmail.com
Tue Nov 3 18:02:59 EST 2009
Hi Robin. Thanks for the patch. It's been applied, and now we get the following:
File "/usr/lib/python2.5/site-packages/reportlab/pdfbase/pdfmetrics.py", line 79, in parseAFMFile
lines = open_and_readlines(afmFileName, 'r')
File "/usr/lib/python2.5/site-packages/reportlab/lib/utils.py", line 462, in open_and_readlines
File "/usr/lib/python2.5/site-packages/reportlab/lib/utils.py", line 459, in open_and_read
File "/usr/lib/python2.5/site-packages/reportlab/lib/utils.py", line 454, in open_for_read
File "/usr/lib/python2.5/site-packages/reportlab/lib/utils.py", line 810, in dump
f = open(self.fn,'wb')
IOError: file() constructor not accessible in restricted mode, while looking for faceName='AGFScalaSansBold'
The faceName matches one which is registered before any other PDF work is done. The IOError is the DebugMemo.dump() failing. I've never seen that error before. Could it be another symptom of the same issue? The original open() for the font could be raising this error. Could it be a side-effect of a mod_python configuration?
FYI, we're running Python 2.5.2 and mod_python 3.3.1.
> -----Original Message-----
> From: reportlab-users-bounces at lists2.reportlab.com
> [mailto:reportlab-users-bounces at lists2.reportlab.com] On
> Behalf Of Robin Becker
> Sent: October 29, 2009 10:43 AM
> To: For users of Reportlab open source software
> Subject: Re: [reportlab-users] Intermittent failure to find
> font, followed by IOError
> My hack to bruteForceSearchForAFM missed out a comma, here's
> a better version
> def bruteForceSearchForAFM(faceName):
> """Looks in all AFM files on path for face with given name.
> Returns AFM file name or None. Ouch!"""
> from reportlab.rl_config import T1SearchPath
> for dirname in T1SearchPath:
> if not rl_isdir(dirname): continue
> possibles = rl_glob(dirname + os.sep + '*.[aA][fF][mM]')
> for possible in possibles:
> topDict, glyphDict = parseAFMFile(possible)
> if topDict['FontName'] == faceName:
> return possible
> v.args = (' '.join(v.args)+', while looking
> for faceName=%r' %
> Robin Becker
> reportlab-users mailing list
> reportlab-users at lists2.reportlab.com
More information about the reportlab-users