RuntimeError after clearing and plotting for many times

Hi,

I got the following error when clearing and plotting on the same
figure for many times. I found the following minimum code to reproduce
this error. I am using matplotlib-0.91.1 and wxpython2.8 on windows
xp. In the matplotlibrc file, I changed the backend to WXAgg and
interactive to True.

import pylab
def test(n):
    for i in range(n):
        f=pylab.figure(1)
        f.clf()
        a=f.add_axes([0.2, 0.2, 0.6, 0.6])
        a.plot([1,2,3,4,5], 'ro')

The error only happens for a large n. For example, test(10) works
fine, but test(50) will cause the error. Also runing test(10) for a
few times will also cause the error.

Could anyone give me some help?

Thanks.

The following is the error message:

Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "<input>", line 3, in test
  File "C:\Python25\Lib\site-packages\matplotlib\pyplot.py", line 191, in figure
  File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_wx.py",
line 1227, in draw_if_interactive
  File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_wxagg.py",
line 61, in draw
  File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py",
line 380, in draw
  File "C:\Python25\Lib\site-packages\matplotlib\figure.py", line 612, in draw
  File "C:\Python25\Lib\site-packages\matplotlib\axes.py", line 1344, in draw
  File "C:\Python25\Lib\site-packages\matplotlib\axis.py", line 596, in draw
  File "C:\Python25\Lib\site-packages\matplotlib\axis.py", line 170, in draw
  File "C:\Python25\Lib\site-packages\matplotlib\text.py", line 775, in draw
  File "C:\Python25\Lib\site-packages\matplotlib\text.py", line 317, in draw
  File "C:\Python25\Lib\site-packages\matplotlib\text.py", line 195,
in _get_layout
  File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py",
line 234, in get_text_width_height_descent
  File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py",
line 301, in _get_agg_font
RuntimeError: Could not open facefile
C:\Python25\lib\site-packages\matplotlib\mpl-data\fonts\ttf\Vera.ttf;
Cannot_Open_Resource

Below is the minimum code with the right indent

import pylab
def test(n):
     for i in range(n):
          f=pylab.figure(1)
          f.clf()
          a=f.add_axes([0.2, 0.2, 0.6, 0.6])
          a.plot([1,2,3,4,5], 'ro')

···

On Dec 2, 2007 4:07 PM, Yongtao Cui <cuiyongtao@...287...> wrote:

Hi,

I got the following error when clearing and plotting on the same
figure for many times. I found the following minimum code to reproduce
this error. I am using matplotlib-0.91.1 and wxpython2.8 on windows
xp. In the matplotlibrc file, I changed the backend to WXAgg and
interactive to True.

import pylab
def test(n):
   for i in range(n):
       f=pylab.figure(1)
       f.clf()
       a=f.add_axes([0.2, 0.2, 0.6, 0.6])
       a.plot([1,2,3,4,5], 'ro')

The error only happens for a large n. For example, test(10) works
fine, but test(50) will cause the error. Also runing test(10) for a
few times will also cause the error.

Could anyone give me some help?

Thanks.

The following is the error message:

Traceback (most recent call last):
File "<input>", line 1, in <module>
File "<input>", line 3, in test
File "C:\Python25\Lib\site-packages\matplotlib\pyplot.py", line 191, in figure
File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_wx.py",
line 1227, in draw_if_interactive
File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_wxagg.py",
line 61, in draw
File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py",
line 380, in draw
File "C:\Python25\Lib\site-packages\matplotlib\figure.py", line 612, in draw
File "C:\Python25\Lib\site-packages\matplotlib\axes.py", line 1344, in draw
File "C:\Python25\Lib\site-packages\matplotlib\axis.py", line 596, in draw
File "C:\Python25\Lib\site-packages\matplotlib\axis.py", line 170, in draw
File "C:\Python25\Lib\site-packages\matplotlib\text.py", line 775, in draw
File "C:\Python25\Lib\site-packages\matplotlib\text.py", line 317, in draw
File "C:\Python25\Lib\site-packages\matplotlib\text.py", line 195,
in _get_layout
File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py",
line 234, in get_text_width_height_descent
File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py",
line 301, in _get_agg_font
RuntimeError: Could not open facefile
C:\Python25\lib\site-packages\matplotlib\mpl-data\fonts\ttf\Vera.ttf;
Cannot_Open_Resource

No help here, just providing a data point for the devs. Under linux, with

In [5]: wx.__version__
Out[5]: '2.8.4.0'

In [6]: matplotlib.__version__
Out[6]: '0.91.1'

I ran test(100) several times, no error.

Cheers,

f

···

On Dec 2, 2007 2:07 PM, Yongtao Cui <cuiyongtao@...287...> wrote:

Could anyone give me some help?

import pylab
def test(n):
    for i in range(n):
         f=pylab.figure(1)
         f.clf()
         a=f.add_axes([0.2, 0.2, 0.6, 0.6])
         a.plot([1,2,3,4,5], 'ro')

I tracked down the svn tree. The above script works ok in revision
3737 and before, but crashes from revision 3738 and after.

Yongtao

···

On Dec 2, 2007 4:15 PM, Yongtao Cui <cuiyongtao@...287...> wrote:

Below is the minimum code with the right indent

import pylab
def test(n):
    for i in range(n):
         f=pylab.figure(1)
         f.clf()
         a=f.add_axes([0.2, 0.2, 0.6, 0.6])
         a.plot([1,2,3,4,5], 'ro')

On Dec 2, 2007 4:07 PM, Yongtao Cui <cuiyongtao@...287...> wrote:
> Hi,
>
> I got the following error when clearing and plotting on the same
> figure for many times. I found the following minimum code to reproduce
> this error. I am using matplotlib-0.91.1 and wxpython2.8 on windows
> xp. In the matplotlibrc file, I changed the backend to WXAgg and
> interactive to True.
>
> import pylab
> def test(n):
> for i in range(n):
> f=pylab.figure(1)
> f.clf()
> a=f.add_axes([0.2, 0.2, 0.6, 0.6])
> a.plot([1,2,3,4,5], 'ro')
>
>
> The error only happens for a large n. For example, test(10) works
> fine, but test(50) will cause the error. Also runing test(10) for a
> few times will also cause the error.
>
> Could anyone give me some help?
>
> Thanks.
>
> The following is the error message:
>
> Traceback (most recent call last):
> File "<input>", line 1, in <module>
> File "<input>", line 3, in test
> File "C:\Python25\Lib\site-packages\matplotlib\pyplot.py", line 191, in figure
> File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_wx.py",
> line 1227, in draw_if_interactive
> File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_wxagg.py",
> line 61, in draw
> File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py",
> line 380, in draw
> File "C:\Python25\Lib\site-packages\matplotlib\figure.py", line 612, in draw
> File "C:\Python25\Lib\site-packages\matplotlib\axes.py", line 1344, in draw
> File "C:\Python25\Lib\site-packages\matplotlib\axis.py", line 596, in draw
> File "C:\Python25\Lib\site-packages\matplotlib\axis.py", line 170, in draw
> File "C:\Python25\Lib\site-packages\matplotlib\text.py", line 775, in draw
> File "C:\Python25\Lib\site-packages\matplotlib\text.py", line 317, in draw
> File "C:\Python25\Lib\site-packages\matplotlib\text.py", line 195,
> in _get_layout
> File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py",
> line 234, in get_text_width_height_descent
> File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py",
> line 301, in _get_agg_font
> RuntimeError: Could not open facefile
> C:\Python25\lib\site-packages\matplotlib\mpl-data\fonts\ttf\Vera.ttf;
> Cannot_Open_Resource
>

I don't know why those spaces always don't show up on the mailing list
webpage. They looked fine on my gmail page.

The 'test' function only has one 'for' loop. The four lines below the
'for' line are all in the loop.

···

On Dec 4, 2007 8:52 PM, Yongtao Cui <cuiyongtao@...287...> wrote:

>>> import pylab
>>> def test(n):
>>> for i in range(n):
>>> f=pylab.figure(1)
>>> f.clf()
>>> a=f.add_axes([0.2, 0.2, 0.6, 0.6])
>>> a.plot([1,2,3,4,5], 'ro')
>>>

I tracked down the svn tree. The above script works ok in revision
3737 and before, but crashes from revision 3738 and after.

Yongtao

On Dec 2, 2007 4:15 PM, Yongtao Cui <cuiyongtao@...287...> wrote:
> Below is the minimum code with the right indent
>
> import pylab
> def test(n):
> for i in range(n):
> f=pylab.figure(1)
> f.clf()
> a=f.add_axes([0.2, 0.2, 0.6, 0.6])
> a.plot([1,2,3,4,5], 'ro')
>
>
> On Dec 2, 2007 4:07 PM, Yongtao Cui <cuiyongtao@...287...> wrote:
> > Hi,
> >
> > I got the following error when clearing and plotting on the same
> > figure for many times. I found the following minimum code to reproduce
> > this error. I am using matplotlib-0.91.1 and wxpython2.8 on windows
> > xp. In the matplotlibrc file, I changed the backend to WXAgg and
> > interactive to True.
> >
> > import pylab
> > def test(n):
> > for i in range(n):
> > f=pylab.figure(1)
> > f.clf()
> > a=f.add_axes([0.2, 0.2, 0.6, 0.6])
> > a.plot([1,2,3,4,5], 'ro')
> >
> >
> > The error only happens for a large n. For example, test(10) works
> > fine, but test(50) will cause the error. Also runing test(10) for a
> > few times will also cause the error.
> >
> > Could anyone give me some help?
> >
> > Thanks.
> >
> > The following is the error message:
> >
> > Traceback (most recent call last):
> > File "<input>", line 1, in <module>
> > File "<input>", line 3, in test
> > File "C:\Python25\Lib\site-packages\matplotlib\pyplot.py", line 191, in figure
> > File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_wx.py",
> > line 1227, in draw_if_interactive
> > File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_wxagg.py",
> > line 61, in draw
> > File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py",
> > line 380, in draw
> > File "C:\Python25\Lib\site-packages\matplotlib\figure.py", line 612, in draw
> > File "C:\Python25\Lib\site-packages\matplotlib\axes.py", line 1344, in draw
> > File "C:\Python25\Lib\site-packages\matplotlib\axis.py", line 596, in draw
> > File "C:\Python25\Lib\site-packages\matplotlib\axis.py", line 170, in draw
> > File "C:\Python25\Lib\site-packages\matplotlib\text.py", line 775, in draw
> > File "C:\Python25\Lib\site-packages\matplotlib\text.py", line 317, in draw
> > File "C:\Python25\Lib\site-packages\matplotlib\text.py", line 195,
> > in _get_layout
> > File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py",
> > line 234, in get_text_width_height_descent
> > File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py",
> > line 301, in _get_agg_font
> > RuntimeError: Could not open facefile
> > C:\Python25\lib\site-packages\matplotlib\mpl-data\fonts\ttf\Vera.ttf;
> > Cannot_Open_Resource
> >
>

I’m running into the very same problem. I’m using matplotlib from a wxPython application, the same versions as you (Yongtao Cui), and I get the same error (see below) after repainting a figure many times. In my case I plot several figures (16 figures) and I get the error with very few repaintings. This didn’t happen with matplotlib 0.90.1.

Any fix besides going back to matplotlib 0.90.1?

Traceback (most recent call last):
Traceback (most recent call last):
File “C:\Tesis\Programa\visualizador.py”, line 93, in on_intervalos

File “C:\Tesis\Programa\visualizador.py”, line 126, in pinta
File “C:\Python25\Lib\site-packages\matplotlib\backends\backend_wxagg.py”, line 61, in draw
File “C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py”, line 380, in draw

File “C:\Python25\Lib\site-packages\matplotlib\figure.py”, line 612, in draw
File “C:\Python25\Lib\site-packages\matplotlib\axes.py”, line 1344, in draw
File “C:\Python25\Lib\site-packages\matplotlib\axis.py”, line 596, in draw

File “C:\Python25\Lib\site-packages\matplotlib\axis.py”, line 170, in draw
File “C:\Python25\Lib\site-packages\matplotlib\text.py”, line 775, in draw
File “C:\Python25\Lib\site-packages\matplotlib\text.py”, line 317, in draw

File “C:\Python25\Lib\site-packages\matplotlib\text.py”, line 195, in _get_layout
File “C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py”, line 234, in get_text_width_height_descent

File “C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py”, line 301, in _get_agg_font
RuntimeError: Could not open facefile C:\WINDOWS\Fonts\verdana.ttf; Cannot_Open_Resource

File “C:\Tesis\Programa\visualizador.py”, line 93, in on_intervalos

File “C:\Tesis\Programa\visualizador.py”, line 126, in pinta
File “C:\Python25\Lib\site-packages\matplotlib\backends\backend_wxagg.py”, line 61, in draw
File “C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py”, line 380, in draw

File “C:\Python25\Lib\site-packages\matplotlib\figure.py”, line 612, in draw
File “C:\Python25\Lib\site-packages\matplotlib\axes.py”, line 1344, in draw
File “C:\Python25\Lib\site-packages\matplotlib\axis.py”, line 596, in draw

File “C:\Python25\Lib\site-packages\matplotlib\axis.py”, line 170, in draw
File “C:\Python25\Lib\site-packages\matplotlib\text.py”, line 775, in draw
File “C:\Python25\Lib\site-packages\matplotlib\text.py”, line 317, in draw

File “C:\Python25\Lib\site-packages\matplotlib\text.py”, line 195, in _get_layout
File “C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py”, line 234, in get_text_width_height_descent

File “C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py”, line 301, in _get_agg_font
RuntimeError: Could not open facefile C:\WINDOWS\Fonts\verdana.ttf; Cannot_Open_Resource

···

On Dec 5, 2007 3:15 AM, Yongtao Cui <cuiyongtao@…287…> wrote:

I don’t know why those spaces always don’t show up on the mailing list
webpage. They looked fine on my gmail page.

The ‘test’ function only has one ‘for’ loop. The four lines below the

‘for’ line are all in the loop.

On Dec 4, 2007 8:52 PM, Yongtao Cui <cuiyongtao@…287…> wrote:

import pylab

def test(n):
for i in range(n):
f=pylab.figure(1)
f.clf()
a=f.add_axes([0.2, 0.2, 0.6
, 0.6])
a.plot([1,2,3,4,5], ‘ro’)

I tracked down the svn tree. The above script works ok in revision
3737 and before, but crashes from revision 3738 and after.

Yongtao

On Dec 2, 2007 4:15 PM, Yongtao Cui <cuiyongtao@…287…> wrote:

Below is the minimum code with the right indent

import pylab
def test(n):
for i in range(n):
f=pylab.figure(1)
f.clf()
a=f.add_axes([0.2, 0.2, 0.6
, 0.6])
a.plot([1,2,3,4,5], ‘ro’)

On Dec 2, 2007 4:07 PM, Yongtao Cui <cuiyongtao@…287…> wrote:

Hi,

I got the following error when clearing and plotting on the same
figure for many times. I found the following minimum code to reproduce
this error. I am using matplotlib-0.91.1 and wxpython2.8 on windows
xp. In the matplotlibrc file, I changed the backend to WXAgg and
interactive to True.

import pylab
def test(n):

for i in range(n):
f=pylab.figure(1)
f.clf()
a=f.add_axes([0.2, 0.2, 0.6, 0.6])
a.plot([1,2,3,4,5], ‘ro’)

The error only happens for a large n. For example, test(10) works
fine, but test(50) will cause the error. Also runing test(10) for a
few times will also cause the error.

Could anyone give me some help?

Thanks.

The following is the error message:

Traceback (most recent call last):

File “”, line 1, in
File “”, line 3, in test
File “C:\Python25\Lib\site-packages\matplotlib\pyplot.py”, line 191, in figure

File “C:\Python25\Lib\site-packages\matplotlib\backends\backend_wx.py”,
line 1227, in draw_if_interactive
File “C:\Python25\Lib\site-packages\matplotlib\backends\backend_wxagg.py”,

line 61, in draw
File “C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py”,
line 380, in draw
File “C:\Python25\Lib\site-packages\matplotlib\figure.py”, line 612, in draw

File “C:\Python25\Lib\site-packages\matplotlib\axes.py”, line 1344, in draw
File “C:\Python25\Lib\site-packages\matplotlib\axis.py”, line 596, in draw
File “C:\Python25\Lib\site-packages\matplotlib\axis.py”, line 170, in draw

File “C:\Python25\Lib\site-packages\matplotlib\text.py”, line 775, in draw
File “C:\Python25\Lib\site-packages\matplotlib\text.py”, line 317, in draw
File “C:\Python25\Lib\site-packages\matplotlib\text.py”, line 195,

in _get_layout
File “C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py”,
line 234, in get_text_width_height_descent
File “C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py”,

line 301, in _get_agg_font
RuntimeError: Could not open facefile
C:\Python25\lib\site-packages\matplotlib\mpl-data\fonts\ttf\Vera.ttf;
Cannot_Open_Resource


SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell. From the desktop to the data center, Linux is going

mainstream. Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4


Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Ok, I’ve just read the thread “Repeated calls to set_text using TeX formatting results in RuntimeError” which looked very similar to our problem and after applying the fix which is suggested there by Michael Droettboom (see below), the problem seems to disappear. Let’s hope this gets fixed in 0.91.2.

Open the file “font_manager.py”, which should live in
"%PYTHONPATH%/Lib/site-package

s/matplotlib". Around line 681, you’ll
find the function:

 def __hash__(self):
     return hash(repr(self.__props))

Change it to:

 def __hash__(self):
     return hash(repr(self.__props.__dict__))

(Obviously, back up the file first…)

···

On Dec 12, 2007 8:32 PM, Armando Serrano Lombillo <arserlom@…287…> wrote:

I’m running into the very same problem. I’m using matplotlib from a wxPython application, the same versions as you (Yongtao Cui), and I get the same error (see below) after repainting a figure many times. In my case I plot several figures (16 figures) and I get the error with very few repaintings. This didn’t happen with matplotlib 0.90.1.

Any fix besides going back to matplotlib 0.90.1?

Traceback (most recent call last):
Traceback (most recent call last):

File “C:\Tesis\Programa\visualizador.py”, line 93, in on_intervalos

File “C:\Tesis\Programa\visualizador.py”, line 126, in pinta

File “C:\Python25\Lib\site-packages\matplotlib\backends\backend_wxagg.py”, line 61, in draw
File “C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py”, line 380, in draw

File “C:\Python25\Lib\site-packages\matplotlib\figure.py”, line 612, in draw
File “C:\Python25\Lib\site-packages\matplotlib\axes.py”, line 1344, in draw
File “C:\Python25\Lib\site-packages\matplotlib\axis.py”, line 596, in draw

File “C:\Python25\Lib\site-packages\matplotlib\axis.py”, line 170, in draw
File “C:\Python25\Lib\site-packages\matplotlib\text.py”, line 775, in draw
File “C:\Python25\Lib\site-packages\matplotlib\text.py”, line 317, in draw

File “C:\Python25\Lib\site-packages\matplotlib\text.py”, line 195, in _get_layout
File “C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py”, line 234, in get_text_width_height_descent

File “C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py”, line 301, in _get_agg_font

RuntimeError: Could not open facefile C:\WINDOWS\Fonts\verdana.ttf; Cannot_Open_Resource

File “C:\Tesis\Programa\visualizador.py”, line 93, in on_intervalos

File “C:\Tesis\Programa\visualizador.py”, line 126, in pinta

File “C:\Python25\Lib\site-packages\matplotlib\backends\backend_wxagg.py”, line 61, in draw
File “C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py”, line 380, in draw

File “C:\Python25\Lib\site-packages\matplotlib\figure.py”, line 612, in draw
File “C:\Python25\Lib\site-packages\matplotlib\axes.py”, line 1344, in draw
File “C:\Python25\Lib\site-packages\matplotlib\axis.py”, line 596, in draw

File “C:\Python25\Lib\site-packages\matplotlib\axis.py”, line 170, in draw
File “C:\Python25\Lib\site-packages\matplotlib\text.py”, line 775, in draw
File “C:\Python25\Lib\site-packages\matplotlib\text.py”, line 317, in draw

File “C:\Python25\Lib\site-packages\matplotlib\text.py”, line 195, in _get_layout
File “C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py”, line 234, in get_text_width_height_descent

File “C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py”, line 301, in _get_agg_font

RuntimeError: Could not open facefile C:\WINDOWS\Fonts\verdana.ttf; Cannot_Open_Resource

On Dec 5, 2007 3:15 AM, Yongtao Cui <cuiyongtao@…287…> wrote:

I don’t know why those spaces always don’t show up on the mailing list
webpage. They looked fine on my gmail page.

The ‘test’ function only has one ‘for’ loop. The four lines below the

‘for’ line are all in the loop.

On Dec 4, 2007 8:52 PM, Yongtao Cui <cuiyongtao@…287…> wrote:

import pylab

def test(n):
for i in range(n):
f=pylab.figure(1)
f.clf()

     a=f.add_axes([0.2, 0.2, 0.6

, 0.6])

     a.plot([1,2,3,4,5], 'ro')

I tracked down the svn tree. The above script works ok in revision
3737 and before, but crashes from revision 3738 and after.

Yongtao

On Dec 2, 2007 4:15 PM, Yongtao Cui <cuiyongtao@…287…> wrote:

Below is the minimum code with the right indent

import pylab
def test(n):
for i in range(n):
f=pylab.figure(1)
f.clf()

     a=f.add_axes([0.2, 0.2, 0.6

, 0.6])

     a.plot([1,2,3,4,5], 'ro')

On Dec 2, 2007 4:07 PM, Yongtao Cui <cuiyongtao@…287… > > > wrote:

Hi,

I got the following error when clearing and plotting on the same
figure for many times. I found the following minimum code to reproduce
this error. I am using matplotlib-0.91.1 and wxpython2.8 on windows
xp. In the matplotlibrc file, I changed the backend to WXAgg and
interactive to True.

import pylab
def test(n):

for i in range(n):
f=pylab.figure(1)
f.clf()
a=f.add_axes([0.2, 0.2, 0.6, 0.6])
a.plot([1,2,3,4,5], ‘ro’)

The error only happens for a large n. For example, test(10) works
fine, but test(50) will cause the error. Also runing test(10) for a
few times will also cause the error.

Could anyone give me some help?

Thanks.

The following is the error message:

Traceback (most recent call last):

File “”, line 1, in
File “”, line 3, in test
File “C:\Python25\Lib\site-packages\matplotlib\pyplot.py”, line 191, in figure

File “C:\Python25\Lib\site-packages\matplotlib\backends\backend_wx.py”,
line 1227, in draw_if_interactive
File “C:\Python25\Lib\site-packages\matplotlib\backends\backend_wxagg.py”,

line 61, in draw
File “C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py”,
line 380, in draw
File “C:\Python25\Lib\site-packages\matplotlib\figure.py”, line 612, in draw

File “C:\Python25\Lib\site-packages\matplotlib\axes.py”, line 1344, in draw
File “C:\Python25\Lib\site-packages\matplotlib\axis.py”, line 596, in draw
File “C:\Python25\Lib\site-packages\matplotlib\axis.py”, line 170, in draw

File “C:\Python25\Lib\site-packages\matplotlib\text.py”, line 775, in draw
File “C:\Python25\Lib\site-packages\matplotlib\text.py”, line 317, in draw
File “C:\Python25\Lib\site-packages\matplotlib\text.py”, line 195,

in _get_layout
File “C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py”,
line 234, in get_text_width_height_descent
File “C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py”,

line 301, in _get_agg_font
RuntimeError: Could not open facefile
C:\Python25\lib\site-packages\matplotlib\mpl-data\fonts\ttf\Vera.ttf;
Cannot_Open_Resource


SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell. From the desktop to the data center, Linux is going

mainstream. Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4


Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
[

matplotlib-users List Signup and Options](matplotlib-users List Signup and Options)

+1

Worked for me too.

Thanks.

···

~
musically_ut

On Dec 12, 2007 7:45 PM, Armando Serrano Lombillo <arserlom@…287…> wrote:

Ok, I’ve just read the thread “Repeated calls to set_text using TeX formatting results in RuntimeError” which looked very similar to our problem and after applying the fix which is suggested there by Michael Droettboom (see below), the problem seems to disappear. Let’s hope this gets fixed in 0.91.2.

Open the file “font_manager.py”, which should live in
“%PYTHONPATH%/Lib/site-package
s/matplotlib”. Around line 681, you’ll
find the function:

 def __hash__(self):
     return hash(repr(self.__props))

Change it to:

 def __hash__(self):
     return hash(repr(self.__props.__dict__))

(Obviously, back up the file first…)

On Dec 12, 2007 8:32 PM, Armando Serrano Lombillo <arserlom@…287…> wrote:

I’m running into the very same problem. I’m using matplotlib from a wxPython application, the same versions as you (Yongtao Cui), and I get the same error (see below) after repainting a figure many times. In my case I plot several figures (16 figures) and I get the error with very few repaintings. This didn’t happen with matplotlib 0.90.1.

Any fix besides going back to matplotlib 0.90.1?

Traceback (most recent call last):
Traceback (most recent call last):

File “C:\Tesis\Programa\visualizador.py”, line 93, in on_intervalos

File “C:\Tesis\Programa\visualizador.py”, line 126, in pinta

File “C:\Python25\Lib\site-packages\matplotlib\backends\backend_wxagg.py”, line 61, in draw
File “C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py”, line 380, in draw

File “C:\Python25\Lib\site-packages\matplotlib\figure.py”, line 612, in draw
File “C:\Python25\Lib\site-packages\matplotlib\axes.py”, line 1344, in draw
File “C:\Python25\Lib\site-packages\matplotlib\axis.py”, line 596, in draw

File “C:\Python25\Lib\site-packages\matplotlib\axis.py”, line 170, in draw
File “C:\Python25\Lib\site-packages\matplotlib\text.py”, line 775, in draw
File “C:\Python25\Lib\site-packages\matplotlib\text.py”, line 317, in draw

File “C:\Python25\Lib\site-packages\matplotlib\text.py”, line 195, in _get_layout
File “C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py”, line 234, in get_text_width_height_descent

File “C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py”, line 301, in _get_agg_font

RuntimeError: Could not open facefile C:\WINDOWS\Fonts\verdana.ttf; Cannot_Open_Resource

File “C:\Tesis\Programa\visualizador.py”, line 93, in on_intervalos

File “C:\Tesis\Programa\visualizador.py”, line 126, in pinta

File “C:\Python25\Lib\site-packages\matplotlib\backends\backend_wxagg.py”, line 61, in draw
File “C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py”, line 380, in draw

File “C:\Python25\Lib\site-packages\matplotlib\figure.py”, line 612, in draw
File “C:\Python25\Lib\site-packages\matplotlib\axes.py”, line 1344, in draw
File “C:\Python25\Lib\site-packages\matplotlib\axis.py”, line 596, in draw

File “C:\Python25\Lib\site-packages\matplotlib\axis.py”, line 170, in draw
File “C:\Python25\Lib\site-packages\matplotlib\text.py”, line 775, in draw
File “C:\Python25\Lib\site-packages\matplotlib\text.py”, line 317, in draw

File “C:\Python25\Lib\site-packages\matplotlib\text.py”, line 195, in _get_layout
File “C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py”, line 234, in get_text_width_height_descent

File “C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py”, line 301, in _get_agg_font

RuntimeError: Could not open facefile C:\WINDOWS\Fonts\verdana.ttf; Cannot_Open_Resource

On Dec 5, 2007 3:15 AM, Yongtao Cui <cuiyongtao@…287…> wrote:

I don’t know why those spaces always don’t show up on the mailing list
webpage. They looked fine on my gmail page.

The ‘test’ function only has one ‘for’ loop. The four lines below the

‘for’ line are all in the loop.

On Dec 4, 2007 8:52 PM, Yongtao Cui <cuiyongtao@…287…> wrote:

import pylab

def test(n):
for i in range(n):
f=pylab.figure(1)
f.clf()

     a=f.add_axes([0.2, 0.2, 0.6

, 0.6])

     a.plot([1,2,3,4,5], 'ro')

I tracked down the svn tree. The above script works ok in revision
3737 and before, but crashes from revision 3738 and after.

Yongtao

On Dec 2, 2007 4:15 PM, Yongtao Cui <cuiyongtao@…287…> wrote:

Below is the minimum code with the right indent

import pylab
def test(n):
for i in range(n):
f=pylab.figure(1)
f.clf()

     a=f.add_axes([0.2, 0.2, 0.6

, 0.6])

     a.plot([1,2,3,4,5], 'ro')

On Dec 2, 2007 4:07 PM, Yongtao Cui <cuiyongtao@…287… > > > > > > > wrote:

Hi,

I got the following error when clearing and plotting on the same
figure for many times. I found the following minimum code to reproduce
this error. I am using matplotlib-0.91.1 and wxpython2.8 on windows
xp. In the matplotlibrc file, I changed the backend to WXAgg and
interactive to True.

import pylab
def test(n):

for i in range(n):
f=pylab.figure(1)
f.clf()
a=f.add_axes([0.2, 0.2, 0.6, 0.6])
a.plot([1,2,3,4,5], ‘ro’)

The error only happens for a large n. For example, test(10) works
fine, but test(50) will cause the error. Also runing test(10) for a
few times will also cause the error.

Could anyone give me some help?

Thanks.

The following is the error message:

Traceback (most recent call last):

File “”, line 1, in
File “”, line 3, in test
File “C:\Python25\Lib\site-packages\matplotlib\pyplot.py”, line 191, in figure

File “C:\Python25\Lib\site-packages\matplotlib\backends\backend_wx.py”,
line 1227, in draw_if_interactive
File “C:\Python25\Lib\site-packages\matplotlib\backends\backend_wxagg.py”,

line 61, in draw
File “C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py”,
line 380, in draw
File “C:\Python25\Lib\site-packages\matplotlib\figure.py”, line 612, in draw

File “C:\Python25\Lib\site-packages\matplotlib\axes.py”, line 1344, in draw
File “C:\Python25\Lib\site-packages\matplotlib\axis.py”, line 596, in draw
File “C:\Python25\Lib\site-packages\matplotlib\axis.py”, line 170, in draw

File “C:\Python25\Lib\site-packages\matplotlib\text.py”, line 775, in draw
File “C:\Python25\Lib\site-packages\matplotlib\text.py”, line 317, in draw
File “C:\Python25\Lib\site-packages\matplotlib\text.py”, line 195,

in _get_layout
File “C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py”,
line 234, in get_text_width_height_descent
File “C:\Python25\Lib\site-packages\matplotlib\backends\backend_agg.py”,

line 301, in _get_agg_font
RuntimeError: Could not open facefile
C:\Python25\lib\site-packages\matplotlib\mpl-data\fonts\ttf\Vera.ttf;
Cannot_Open_Resource


SF.Net email is sponsored by: The Future of Linux Business White Paper
from Novell. From the desktop to the data center, Linux is going

mainstream. Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4


Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
[

matplotlib-users List Signup and Options](matplotlib-users List Signup and Options)


SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It’s the best place to buy or sell services

for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace


Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Never trust a spiritual leader who cannot dance. ~Mr. Miyagi, The Next Karate Kid