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

Robin Becker robin at reportlab.com
Wed Oct 28 07:02:29 EDT 2009


Stevens, Ian wrote:

> Hi all. Earlier this year, I posted a problem we had been having with our production servers.

>

........

> IOError: Cannot open resource "/usr/lib/python2.5/site-packages/reportlab/fonts/DarkGardenMK.afm"

>

........

If it helps, I can say that we used to run Django via mod_python, but did not
see this particular issue.

First off it seems particularly strange that you see DarkGardenMK.afm(or earlier
LetError) mentioned. We include this font purely as an exemplar of a type 1
font. So far as I know none of the standard library code is actually using it. I
believe it may be mentioned in reportlab/graphics/testshapes.py. Are you
importing that module or are you explicitly using this font?

Apache+mod_python presumably runs as a special user say www; does that cause any
problems of reading etc etc?

Secondly as your apache test seems to imply this may be a threading issue. The
base ReportLab toolkit is not thread safe. Thus if one thread is in the process
of reading a file when another thread attempts to open the same file it's
entirely possible that something odd may happen. Calling the reset function may
actually make things worse for multi-threaded programs.

We run django using flup (http://www.saddi.com/projects/index.html) in prefork
mode and have never had any serious issues.

My experience of the mod_python approach was that we did encounter some problems
related to threading and/or encapsulation (ie privacy between apps). In the flup
prefork approach at least I believe the django wsgi server is running single
threaded; also since we control the startup of the server as a normal user then
only the flup socket needs to be writable by www.
--
Robin Becker


More information about the reportlab-users mailing list