[mod_python] problem to import pylab of matplotlib

John Hunter jdhunter at nitace.bsd.uchicago.edu
Fri May 27 09:46:38 EDT 2005

>>>>> "Damien" == Damien  <modpython at free.fr> writes:
    Damien>   File
    Damien> "/usr/lib/python2.3/site-packages/matplotlib/font_manager.py",
    Damien> line 829, in rebuild pickle.dump(self.ttfdict,
    Damien> file(ttfcache, 'w'))

    Damien> IOError: [Errno 13] Permission denied:
    Damien> '/root/.ttffont.cache'

    Damien> but when after 4 refresh of this page in my firefox, the
    Damien> error message change to the previous message.  why
    Damien> desactivate this phenomene ?

matplotlib keeps a cache of the font information it finds on your
system, so it needs a writable directory.  It first tries "HOME" and
if it is not found falls back on it's data path, which can be set with
the MATPLOTLIBDATA environment variable.  MATPLOTLIBDATA is the
directory in which all of matplotlib's fonts, etc, live, and is not
writable on a typical install, so the best approach is to set HOME to
a writable directory.

Also, I advise you not to use the pylab interface in a web application
server (though you can).  pylab does a fair amount of work under the
hood, managing the current figure and so on, and in an application
server you might rather have full control of the whole process.  pylab
is simply a thin wrapper to the object oriented matplotlib API, and
you can find some guidance on how to use it at 


In particular, see the script

Hope this helps,

More information about the Mod_python mailing list