RuntimeError: Could not open facefile

Hello,

I am getting this runtime error for some of my plotting scripts ever since I did a clean build and install of matplotlib from the svn repo:

[snip]
File “/home/bvr/Programs/matplotlib/matplotlib/lib/matplotlib/text.py”, line 524, in draw

bbox, info = self._get_layout(renderer)

File “/home/bvr/Programs/matplotlib/matplotlib/lib/matplotlib/text.py”, line 298, in _get_layout
ismath=False)
File “/home/bvr/Programs/matplotlib/matplotlib/lib/matplotlib/backends/backend_gdk.py”, line 309, in get_text_width_height_descent

layout, inkRect, logicalRect = self._get_pango_layout(s, prop)

File “/home/bvr/Programs/matplotlib/matplotlib/lib/matplotlib/backends/backend_gdk.py”, line 283, in _get_pango_layout
font_str = ‘%s, %s %i’ % (prop.get_name(), prop.get_style(), size,)

File “/home/bvr/Programs/matplotlib/matplotlib/lib/matplotlib/font_manager.py”, line 742, in get_name
return ft2font.FT2Font(str(findfont(self))).family_name
RuntimeError: Could not open facefile /home/bvr/Programs/matplotlib/lib/matplotlib/mpl-data/fonts/ttf/Vera.ttf; Cannot_Open_Resource

The file exists, and is certainly read-able. The program “Fonty Python” even checked and said that the fonts in that folder were valid, and displayed samples. Looking back at discussion threads before, this error has come up before back in 2007: http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg05229.html

Any thoughts?

Thanks,
Ben Root

Hello,

I am getting this runtime error for some of my plotting scripts ever since I
did a clean build and install of matplotlib from the svn repo:

[snip]
File "/home/bvr/Programs/matplotlib/matplotlib/lib/matplotlib/text.py", line
524, in draw
bbox, info = self._get_layout(renderer)
File "/home/bvr/Programs/matplotlib/matplotlib/lib/matplotlib/text.py",
line 298, in _get_layout
ismath=False)
File
"/home/bvr/Programs/matplotlib/matplotlib/lib/matplotlib/backends/backend_gdk.py",
line 309, in get_text_width_height_descent
layout, inkRect, logicalRect = self._get_pango_layout(s, prop)
File
"/home/bvr/Programs/matplotlib/matplotlib/lib/matplotlib/backends/backend_gdk.py",
line 283, in _get_pango_layout
font_str = '%s, %s %i' % (prop.get_name(), prop.get_style(), size,)
File
"/home/bvr/Programs/matplotlib/matplotlib/lib/matplotlib/font_manager.py",
line 742, in get_name
return ft2font.FT2Font(str(findfont(self))).family_name
RuntimeError: Could not open facefile
/home/bvr/Programs/matplotlib/lib/matplotlib/mpl-data/fonts/ttf/Vera.ttf;
Cannot_Open_Resource

The file exists, and is certainly read-able. The program "Fonty Python"
even checked and said that the fonts in that folder were valid, and
displayed samples. Looking back at discussion threads before, this error has
come up before back in 2007:
Re: [Matplotlib-users] RuntimeError after clearing and plotting for many times

Any thoughts?

Just a shot in the dark, but does it help to flush the font cache in
your .matplotlib dir?

  > rm -rf ~/.matplotlib/font*.cache

JDH

···

On Thu, Jun 3, 2010 at 2:41 PM, Benjamin Root <ben.root@...553...> wrote:

Yes! Thank you!

As extra debugging info, the issue was happening regardless of me choosing GTK, GTKAgg, and others for backends.

Ben Root

···

On Thu, Jun 3, 2010 at 2:45 PM, John Hunter <jdh2358@…149…> wrote:

On Thu, Jun 3, 2010 at 2:41 PM, Benjamin Root <ben.root@…553…> wrote:

Hello,

I am getting this runtime error for some of my plotting scripts ever since I

did a clean build and install of matplotlib from the svn repo:

[snip]

File “/home/bvr/Programs/matplotlib/matplotlib/lib/matplotlib/text.py”, line

524, in draw

bbox, info = self._get_layout(renderer)

File “/home/bvr/Programs/matplotlib/matplotlib/lib/matplotlib/text.py”,

line 298, in _get_layout

ismath=False)

File

“/home/bvr/Programs/matplotlib/matplotlib/lib/matplotlib/backends/backend_gdk.py”,

line 309, in get_text_width_height_descent

layout, inkRect, logicalRect = self._get_pango_layout(s, prop)

File

“/home/bvr/Programs/matplotlib/matplotlib/lib/matplotlib/backends/backend_gdk.py”,

line 283, in _get_pango_layout

font_str = '%s, %s %i' % (prop.get_name(), prop.get_style(), size,)

File

“/home/bvr/Programs/matplotlib/matplotlib/lib/matplotlib/font_manager.py”,

line 742, in get_name

return ft2font.FT2Font(str(findfont(self))).family_name

RuntimeError: Could not open facefile

/home/bvr/Programs/matplotlib/lib/matplotlib/mpl-data/fonts/ttf/Vera.ttf;

Cannot_Open_Resource

The file exists, and is certainly read-able. The program “Fonty Python”

even checked and said that the fonts in that folder were valid, and

displayed samples. Looking back at discussion threads before, this error has

come up before back in 2007:

http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg05229.html

Any thoughts?

Just a shot in the dark, but does it help to flush the font cache in

your .matplotlib dir?

rm -rf ~/.matplotlib/font*.cache

JDH

Hi there,

I am a newcomer to this sort of thing, and inherited some Python code that
used matplotlib. I compiled the code as a windows executable, and sent it
out to my students.. Now, one of them is coming back to me with the error
you speak of.. (i.e. facefile problem with Vera.ttf)

Any hint on getting around this?

Maybe I need to give more info, however I am not sure what you might need..

Any help, gratefully accepted.

Benjamin Root-2 wrote:

···

Yes! Thank you!

As extra debugging info, the issue was happening regardless of me choosing
GTK, GTKAgg, and others for backends.

Ben Root

On Thu, Jun 3, 2010 at 2:45 PM, John Hunter <jdh2358@...149...> wrote:

Just a shot in the dark, but does it help to flush the font cache in
your .matplotlib dir?

> rm -rf ~/.matplotlib/font*.cache

JDH

--
View this message in context: http://old.nabble.com/RuntimeError%3A-Could-not-open-facefile-tp28772066p29879230.html
Sent from the matplotlib - devel mailing list archive at Nabble.com.