[Pythonmac-SIG] Problem bundling matplotlib with py2app: it looks for a font in /Library/Frameworks
Russell E. Owen
rowen at uw.edu
Fri Oct 8 22:48:50 CEST 2010
In article <rowen-BCE283.11090408102010 at news.gmane.org>,
"Russell E. Owen" <rowen at uw.edu> wrote:
> I have a Mac python application I bundle with py2app. It has
> successfully included matplotlib for several years. However recently I
> added strip charts to it and now I find that the Mac bundle is broken:
> when I run on a system that does not have matplotlib installed it dies
> with a traceback...(could not find font file in /Library/Frameworks/Python...)
I found the problem, though not a robust solution. The problem is that
matplotlib is using the font cache in ~/.matplotlib. Sometimes this gets
out of date and then font files cannot be found. Unfortunately
matplotlib does not realize the data is bogus and so crashes instead of
rebuilding the cache files.
I have gotten two user reports of this problem. It also invalidates what
I thought was a pretty solid test of whether my application is properly
self-contained: move the Python, Tcl and Tk frameworks out of the way
and then run my bundle. I have to also delete the matplotlib caches and
then remember to delete them again after the test.
It would be really, really nice to have a standard way of forcing
matplotlib to ignore cache files (neither read nor write them).
An adequate but less thorough solution is for matplotlib to test the
font cache when it first loads it (e.g. by trying to find a font) and
rebuild it if it doesn't work.
-- Russell
More information about the Pythonmac-SIG
mailing list