On 10/01/2010 11:31 AM, Jason Grout wrote:
> I'm working on updating matplotlib in Sage to 1.0.  We're running into
> a problem where it seems that the fontList.cache is not being updated.
> I've included an example session below.  The .matplotlib directory is
> accessible here:
> http://sage.math.washington.edu/home/jason/.matplotlib/  The problem
> seems to be that it is looking for a file that does not exist:
>
> [ja...@sage:/scratch/jason/sage-4.6.alpha2]$ ls
> /scratch/grout/sage-4.5.3/local/lib/python2.6/site-packages/matplotlib/mpl-data/fonts/ttf/Vera.ttf
> ls: cannot access
> /scratch/grout/sage-4.5.3/local/lib/python2.6/site-packages/matplotlib/mpl-data/fonts/ttf/Vera.ttf:
> No such file or directory
>
>
> Does anyone have any idea what is going on?  Why is the fontList.cache
> file not being updated, instead of trying to access a path that doesn't
> exist?
There is a fix in SVN for this, but it has not yet been released.  When 
a font file is not found, it rebuilds the entire font cache on the spot.
> A related question is: I see the variable USE_FONTCONFIG in
> font_manager.py.  It says it is experimental.  How stable is that code?
> It's tempting to switch to using fontconfig.
I use it as a matter of course on my Linux box and haven't had any 
issues.  It's experimental because it's the kind of thing that is so 
affected by external environmental issues and distro differences.  Just 
because it "works for me", there's no guarantee it will work 
everywhere.  But go ahead and give it a try and report back with the 
distro you're using.

Mike
> Thanks,
>
> Jason
>
>
> Here is my example session:
>
> In [1]: from pylab import *
>
> In [2]: text(0.5, 0.5, 'text 0')
> Out[2]:<matplotlib.text.Text object at 0x18e7b50>
>
> In [3]: savefig('test.png')
> ERROR: An unexpected error occurred while tokenizing input
> The following traceback may be corrupted or invalid
> The error message is: ('EOF in multi-line statement', (532, 0))
>
> ERROR: An unexpected error occurred while tokenizing input
> The following traceback may be corrupted or invalid
> The error message is: ('EOF in multi-line statement', (643, 0))
>
> ERROR: An unexpected error occurred while tokenizing input
> The following traceback may be corrupted or invalid
> The error message is: ('EOF in multi-line statement', (10, 0))
>
> ---------------------------------------------------------------------------
> RuntimeError                              Traceback (most recent call last)
>
> /mnt/usb1/scratch/jason/sage-4.6.alpha2/<ipython console>  in<module>()
>
> /mnt/usb1/scratch/jason/sage-4.6.alpha2/local/lib/python2.6/site-packages/matplotlib/pyplot.pyc
> in savefig(*args, **kwargs)
>       361 def savefig(*args, **kwargs):
>       362     fig = gcf()
> -->  363     return fig.savefig(*args, **kwargs)
>       364
>       365 @docstring.copy_dedent(Figure.ginput)
>
> /mnt/usb1/scratch/jason/sage-4.6.alpha2/local/lib/python2.6/site-packages/matplotlib/figure.pyc
> in savefig(self, *args, **kwargs)
>      1082             kwargs.setdefault('edgecolor',
> rcParams['savefig.edgecolor'])
>      1083
> ->  1084         self.canvas.print_figure(*args, **kwargs)
>      1085
>      1086         if transparent:
>
> /mnt/usb1/scratch/jason/sage-4.6.alpha2/local/lib/python2.6/site-packages/matplotlib/backend_bases.pyc
> in print_figure(self, filename, dpi, facecolor, edgecolor, orientation,
> format, **kwargs)
>      1884                 orientation=orientation,
>      1885                 bbox_inches_restore=_bbox_inches_restore,
> ->  1886                 **kwargs)
>      1887         finally:
>      1888             if bbox_inches and restore_bbox:
>
> /mnt/usb1/scratch/jason/sage-4.6.alpha2/local/lib/python2.6/site-packages/matplotlib/backends/backend_agg.pyc
> in print_png(self, filename_or_obj, *args, **kwargs)
>       436
>       437     def print_png(self, filename_or_obj, *args, **kwargs):
> -->  438         FigureCanvasAgg.draw(self)
>       439         renderer = self.get_renderer()
>       440         original_dpi = renderer.dpi
>
> /mnt/usb1/scratch/jason/sage-4.6.alpha2/local/lib/python2.6/site-packages/matplotlib/backends/backend_agg.pyc
> in draw(self)
>       392
>       393         self.renderer = self.get_renderer()
> -->  394         self.figure.draw(self.renderer)
>       395
>       396     def get_renderer(self):
>
> /mnt/usb1/scratch/jason/sage-4.6.alpha2/local/lib/python2.6/site-packages/matplotlib/artist.pyc
> in draw_wrapper(artist, renderer, *args, **kwargs)
>        53     def draw_wrapper(artist, renderer, *args, **kwargs):
>        54         before(artist, renderer)
> --->  55         draw(artist, renderer, *args, **kwargs)
>        56         after(artist, renderer)
>        57
>
> /mnt/usb1/scratch/jason/sage-4.6.alpha2/local/lib/python2.6/site-packages/matplotlib/figure.pyc
> in draw(self, renderer)
>       796         dsu.sort(key=itemgetter(0))
>       797         for zorder, func, args in dsu:
> -->  798             func(*args)
>       799
>       800         renderer.close_group('figure')
>
> /mnt/usb1/scratch/jason/sage-4.6.alpha2/local/lib/python2.6/site-packages/matplotlib/artist.pyc
> in draw_wrapper(artist, renderer, *args, **kwargs)
>        53     def draw_wrapper(artist, renderer, *args, **kwargs):
>        54         before(artist, renderer)
> --->  55         draw(artist, renderer, *args, **kwargs)
>        56         after(artist, renderer)
>        57
>
> /mnt/usb1/scratch/jason/sage-4.6.alpha2/local/lib/python2.6/site-packages/matplotlib/axes.pyc
> in draw(self, renderer, inframe)
>      1932
>      1933         for zorder, a in dsu:
> ->  1934             a.draw(renderer)
>      1935
>      1936         renderer.close_group('axes')
>
> /mnt/usb1/scratch/jason/sage-4.6.alpha2/local/lib/python2.6/site-packages/matplotlib/artist.pyc
> in draw_wrapper(artist, renderer, *args, **kwargs)
>        53     def draw_wrapper(artist, renderer, *args, **kwargs):
>        54         before(artist, renderer)
> --->  55         draw(artist, renderer, *args, **kwargs)
>        56         after(artist, renderer)
>        57
>
> /mnt/usb1/scratch/jason/sage-4.6.alpha2/local/lib/python2.6/site-packages/matplotlib/axis.pyc
> in draw(self, renderer, *args, **kwargs)
>      1015             tick.set_label1(label)
>      1016             tick.set_label2(label)
> ->  1017             tick.draw(renderer)
>      1018             if tick.label1On and tick.label1.get_visible():
>      1019                 extent = tick.label1.get_window_extent(renderer)
>
> /mnt/usb1/scratch/jason/sage-4.6.alpha2/local/lib/python2.6/site-packages/matplotlib/artist.pyc
> in draw_wrapper(artist, renderer, *args, **kwargs)
>        53     def draw_wrapper(artist, renderer, *args, **kwargs):
>        54         before(artist, renderer)
> --->  55         draw(artist, renderer, *args, **kwargs)
>        56         after(artist, renderer)
>        57
>
> /mnt/usb1/scratch/jason/sage-4.6.alpha2/local/lib/python2.6/site-packages/matplotlib/axis.pyc
> in draw(self, renderer)
>       232
>       233         if self.label1On:
> -->  234             self.label1.draw(renderer)
>       235         if self.label2On:
>       236             self.label2.draw(renderer)
>
> /mnt/usb1/scratch/jason/sage-4.6.alpha2/local/lib/python2.6/site-packages/matplotlib/artist.pyc
> in draw_wrapper(artist, renderer, *args, **kwargs)
>        53     def draw_wrapper(artist, renderer, *args, **kwargs):
>        54         before(artist, renderer)
> --->  55         draw(artist, renderer, *args, **kwargs)
>        56         after(artist, renderer)
>        57
>
> /mnt/usb1/scratch/jason/sage-4.6.alpha2/local/lib/python2.6/site-packages/matplotlib/text.pyc
> in draw(self, renderer)
>       522         renderer.open_group('text', self.get_gid())
>       523
> -->  524         bbox, info = self._get_layout(renderer)
>       525         trans = self.get_transform()
>       526
>
> /mnt/usb1/scratch/jason/sage-4.6.alpha2/local/lib/python2.6/site-packages/matplotlib/text.pyc
> in _get_layout(self, renderer)
>       296         tmp, lp_h, lp_bl = get_text_width_height_descent('lp',
>       297
> self._fontproperties,
> -->  298
> ismath=False)
>       299         offsety = lp_h * self._linespacing
>       300
>
> /mnt/usb1/scratch/jason/sage-4.6.alpha2/local/lib/python2.6/site-packages/matplotlib/backends/backend_agg.pyc
> in get_text_width_height_descent(self, s, prop, ismath)
>       178
>       179         flags = self._get_hinting_flag()
> -->  180         font = self._get_agg_font(prop)
>       181         font.set_text(s, 0.0, flags=flags)  # the width and
> height of unrotated string
>       182         w, h = font.get_width_height()
>
> /mnt/usb1/scratch/jason/sage-4.6.alpha2/local/lib/python2.6/site-packages/matplotlib/backends/backend_agg.pyc
> in _get_agg_font(self, prop)
>       219             font = self._fontd.get(fname)
>       220             if font is None:
> -->  221                 font = FT2Font(str(fname))
>       222                 self._fontd[fname] = font
>       223             self._fontd[key] = font
>
> RuntimeError: Could not open facefile
> /scratch/grout/sage-4.5.3/local/lib/python2.6/site-packages/matplotlib/mpl-data/fonts/ttf/Vera.ttf;
> Cannot_Open_Resource
>
>
>
> ------------------------------------------------------------------------------
> Start uncovering the many advantages of virtual appliances
> and start using them to simplify application deployment and
> accelerate your shift to cloud computing.
> http://p.sf.net/sfu/novell-sfdev2dev
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users


------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to