[Matplotlib-users] fontList.cache not being updated

2010-10-01 Thread Jason Grout
  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?

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.

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')


Re: [Matplotlib-users] fontList.cache not being updated

2010-10-01 Thread Michael Droettboom
  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  inmodule()

 /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')

 

Re: [Matplotlib-users] fontList.cache not being updated

2010-10-01 Thread Jason Grout
  On 10/01/2010 10:40 AM, Michael Droettboom wrote:
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.

Thanks.  Do you know the commit?  We'll apply it to the Sage matplotlib 
package.


 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.


Well, with Sage, we're using it on a number of distros, flavors of OSX, 
Solaris, etc.  So maybe I'll stick with the home-grown caching 
solution.  At least until we've tested it a bit on different support 
platforms for Sage.

I thought there was some sort of build bot for matplotlib that tested on 
a number of platforms.  Do you know how the fontconfig stuff does on 
that (if it exists...).

Thanks,

Jason


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


Re: [Matplotlib-users] fontList.cache not being updated

2010-10-01 Thread Michael Droettboom
  On 10/01/2010 11:46 AM, Jason Grout wrote:
On 10/01/2010 10:40 AM, Michael Droettboom wrote:
 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.
 Thanks.  Do you know the commit?  We'll apply it to the Sage matplotlib
 package.


It's r8712.
 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.

 Well, with Sage, we're using it on a number of distros, flavors of OSX,
 Solaris, etc.  So maybe I'll stick with the home-grown caching
 solution.  At least until we've tested it a bit on different support
 platforms for Sage.

 I thought there was some sort of build bot for matplotlib that tested on
 a number of platforms.  Do you know how the fontconfig stuff does on
 that (if it exists...).
I don't think the buildbots are turning on fontconfig support.  And I 
believe all of the buildbots are some flavour of Ubuntu (the OS-X 
buildbot is not running), so there's not a lot of coverage.

Mike
 Thanks,

 Jason


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