[reportlab-users] Intermittent failure to find font, followed by IOError

Robin Becker robin at reportlab.com
Wed Nov 4 05:36:43 EST 2009


Stevens, Ian wrote:

> 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

> return open_and_read(name,mode).split('\n')

>

> File "/usr/lib/python2.5/site-packages/reportlab/lib/utils.py", line 459, in open_and_read

> return open_for_read(name,mode).read()

>

> File "/usr/lib/python2.5/site-packages/reportlab/lib/utils.py", line 454, in open_for_read

> dbg.dump()

>

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

>

I think you're right; if open (ie alias of file) is not availble in the dump
then it might well be the problem in the original open.

Googling for the error message "IOError: file() constructor not accessible in
restricted mode" seems to indicate that it might be related to rexec/mod_python.

This link seems to bear out my opinion that Python restricted mode ought to be
considered useless

http://www.dalkescientific.com/writings/diary/archive/2008/03/03/restricted_python.html

this email

http://www.modpython.org/pipermail/mod_python/2004-April/015476.html

seems to imply this has been seen in mod_python land before. I think the
implication of the latter is that code is being executed in the wrong thread. I
will try asking about this on clp.




> FYI, we're running Python 2.5.2 and mod_python 3.3.1.

>

> Thanks,

> Ian.

>

>.......

--
Robin Becker


More information about the reportlab-users mailing list