Re: [Matplotlib-users] Repeated calls to set_text using TeX formatting results in RuntimeError

2007-12-11 Thread Michael Droettboom
I believe this is a known bug with 0.90.1.  Are you able to run 0.91.1?

Cheers,
Mike

[EMAIL PROTECTED] wrote:
 I'm doing a parameter fitting exercise, and plotting the progress as I 
 do so.  I have found that repeated calls to set_text() on a text object 
 will result in an error opening a font file iff the text uses TeX 
 formatting.  (I am not using the experimental usetex feature).
 
 I speculate that matplotlib is opening the font file anew with each call 
 to set_text and never closing it, resulting ultimately in having too 
 many files open.  Here is a brief program to reproduce this behavior  
 (WinXP, Py2.5, matplotlib 0.90.1):
 
 
 from pylab import figure, axes, draw, ion
 from numpy import array, cos, abs
 ion()
 fig=figure()
 axs=axes()
 x=array(range(100))/10.0
 cosPlot=axs.plot( x, cos(x)**2, 'r' )
 powText = axs.text(0.9,0.02,r'$\alpha=$',
 horizontalalignment='left',verticalalignment='bottom',
 transform = axs.transAxes)
 draw()
 for alpha in array(range(10,400))/100.0:
 axs.lines[-1].set_ydata( abs(cos(x))**alpha)
 powText.set_text(r'$\alpha=%.4g$'%alpha)
 print alpha
 draw()

 
 
 
 
 Traceback (most recent call last):
   File delme.py, line 16, in module
   File 
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matplotlib\pylab.py,
  
 line 754, in draw
   File 
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matplotlib\backends\backend_tkagg.py,
  
 line 154, in draw
 
   File 
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matplotlib\backends\backend_agg.py,
  
 line 392, in draw
 
   File 
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matplotlib\figure.py,
  
 line 601, in draw
   File 
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matplotlib\axes.py,
  
 line 1286, in draw
   File 
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matplotlib\text.py,
  
 line 410, in draw
   File 
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matplotlib\text.py,
  
 line 255, in _get_layout
   File 
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matplotlib\backends\backend_agg.py,
  
 line 246, in get_text_width_height
 
   File 
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matplotlib\mathtext.py,
  
 line 1569, in __call__
   File 
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matplotlib\mathtext.py,
  
 line 578, in __init__
 RuntimeError: Could not open facefile 
 c:\Python25\lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matplotlib\mpl-data\fonts\ttf\cmtt10.ttf;
  
 Cannot_Open_Resource
 
 
 
 
 -
 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://sourceforge.net/services/buy/index.php
 
 
 
 
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users

-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

-
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://sourceforge.net/services/buy/index.php
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Repeated calls to set_text using TeX formatting results in RuntimeError

2007-12-11 Thread Brian.Boonstra
 I'm doing a parameter fitting exercise, and plotting the progress as I
 do so.  I have found that repeated calls to set_text() on a text
 object will result in an error opening a font file iff the text uses
 TeX formatting.  (I am not using the experimental usetex feature).
 
 I speculate that matplotlib is opening the font file anew with each
 call to set_text and never closing it, resulting ultimately in having
 too many files open.  Here is a brief program to reproduce this
 behavior  (WinXP, Py2.5, matplotlib 0.90.1):
 
 
 from pylab import figure, axes, draw, ion
 from numpy import array, cos, abs
 ion()
 fig=figure()
 axs=axes()
 x=array(range(100))/10.0
 cosPlot=axs.plot( x, cos(x)**2, 'r' )
 powText = axs.text(0.9,0.02,r'$\alpha=$',
  
 horizontalalignment='left',verticalalignment='bottom',
 transform = axs.transAxes)
 draw()
 for alpha in array(range(10,400))/100.0:
 axs.lines[-1].set_ydata( abs(cos(x))**alpha)
 powText.set_text(r'$\alpha=%.4g$'%alpha)
 print alpha
 draw()
 
 
 
 
 
 Traceback (most recent call last):
   File delme.py, line 16, in module
   File
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matpl
 otlib\pylab.py, line 754, in draw
   File
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matpl
 otlib\backends\backend_tkagg.py, line 154, in draw
   File
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matpl
 otlib\backends\backend_agg.py, line 392, in draw
   File
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matpl
 otlib\figure.py, line 601, in draw
   File
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matpl
 otlib\axes.py, line 1286, in draw
   File
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matpl
 otlib\text.py, line 410, in draw
   File
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matpl
 otlib\text.py, line 255, in _get_layout
   File
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matpl
 otlib\backends\backend_agg.py, line 246, in get_text_width_height
   File
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matpl
 otlib\mathtext.py, line 1569, in __call__
   File
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matpl
 otlib\mathtext.py, line 578, in __init__
 RuntimeError: Could not open facefile
 c:\Python25\lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matplo
 tlib\mpl-data\fonts\ttf\cmtt10.ttf; Cannot_Open_Resource

This message contains confidential information and is intended only
for the individual named.  If you are not the named addressee you
should not disseminate, distribute or copy this e-mail.  Please
notify the sender immediately by e-mail if you have received this
e-mail by mistake and delete this e-mail from your system and destroy 
any copies thereof.

E-mail transmission cannot be guaranteed to be secure or error-free
as information could be intercepted, corrupted, lost, destroyed,
arrive late or incomplete, or contain viruses.  The sender therefore
does not accept liability for any errors or omissions in the contents
of this message which arise as a result of e-mail transmission.  If
verification is required please request a hard-copy version.  This
message is provided for informational purposes and should not be
construed as a solicitation or offer to buy or sell any securities or
related financial instruments.

-
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://sourceforge.net/services/buy/index.php___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Repeated calls to set_text using TeX formatting results in RuntimeError

2007-12-11 Thread John Hunter
On Dec 11, 2007 8:17 AM, Michael Droettboom [EMAIL PROTECTED] wrote:
 I believe this is a known bug with 0.90.1.  Are you able to run 0.91.1?

If I am reading this right, according to the svn log, you fixed this in

  r4633 | mdboom | 2007-12-05 14:28:28 -0600 (Wed, 05 Dec 2007) | 2 lines

  Fix bug where font files were opened many more times than they need to be.

and 0.91.1 was released at r4517.  So this fix may not be out until
the 0.91.2 point release.  Or were you referring to a different fix?

JDH

-
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://sourceforge.net/services/buy/index.php
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Repeated calls to set_text using TeX formatting results in RuntimeError

2007-12-11 Thread Michael Droettboom
This bug is that many font files were being opened than needed, but they 
were still all getting closed.

Much earlier, someone else fixed a bug where they weren't getting closed 
at all.

http://sourceforge.net/tracker/index.php?func=detailaid=1695171group_id=80706atid=560720
http://sourceforge.net/tracker/index.php?func=detailaid=1715662group_id=80706atid=560720

Cheers,
Mike

John Hunter wrote:
 On Dec 11, 2007 8:17 AM, Michael Droettboom [EMAIL PROTECTED] wrote:
 I believe this is a known bug with 0.90.1.  Are you able to run 0.91.1?
 
 If I am reading this right, according to the svn log, you fixed this in
 
   r4633 | mdboom | 2007-12-05 14:28:28 -0600 (Wed, 05 Dec 2007) | 2 lines
 
   Fix bug where font files were opened many more times than they need to be.
 
 and 0.91.1 was released at r4517.  So this fix may not be out until
 the 0.91.2 point release.  Or were you referring to a different fix?
 
 JDH

-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

-
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://sourceforge.net/services/buy/index.php
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Repeated calls to set_text using TeX formatting results in RuntimeError

2007-12-11 Thread Brian.Boonstra
 I believe this is a known bug with 0.90.1.  Are you able to run
0.91.1?


I just upgraded and checked -- the bug still exists in 0.91.1.  I'm
afraid I don't know whether it has been fixed by r4633 or not.

Best,
   Brian 


[EMAIL PROTECTED] wrote:
 I'm doing a parameter fitting exercise, and plotting the progress as I

 do so.  I have found that repeated calls to set_text() on a text 
 object will result in an error opening a font file iff the text uses 
 TeX formatting.  (I am not using the experimental usetex feature).
 
 I speculate that matplotlib is opening the font file anew with each 
 call to set_text and never closing it, resulting ultimately in having 
 too many files open.  Here is a brief program to reproduce this 
 behavior (WinXP, Py2.5, matplotlib 0.90.1):
 
 
 from pylab import figure, axes, draw, ion from numpy import array, 
 cos, abs
 ion()
 fig=figure()
 axs=axes()
 x=array(range(100))/10.0
 cosPlot=axs.plot( x, cos(x)**2, 'r' )
 powText = axs.text(0.9,0.02,r'$\alpha=$',

horizontalalignment='left',verticalalignment='bottom',
 transform = axs.transAxes)
 draw()
 for alpha in array(range(10,400))/100.0:
 axs.lines[-1].set_ydata( abs(cos(x))**alpha)
 powText.set_text(r'$\alpha=%.4g$'%alpha)
 print alpha
 draw()

 
 
 
 
 Traceback (most recent call last):
   File delme.py, line 16, in module
   File
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matpl
 otlib\pylab.py,
 line 754, in draw
   File
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matpl
 otlib\backends\backend_tkagg.py,
 line 154, in draw
 
   File
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matpl
 otlib\backends\backend_agg.py,
 line 392, in draw
 
   File
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matpl
 otlib\figure.py,
 line 601, in draw
   File
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matpl
 otlib\axes.py,
 line 1286, in draw
   File
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matpl
 otlib\text.py,
 line 410, in draw
   File
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matpl
 otlib\text.py,
 line 255, in _get_layout
   File
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matpl
 otlib\backends\backend_agg.py,
 line 246, in get_text_width_height
 
   File
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matpl
 otlib\mathtext.py,
 line 1569, in __call__
   File
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matpl
 otlib\mathtext.py,
 line 578, in __init__
 RuntimeError: Could not open facefile 
 c:\Python25\lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matplo
 tlib\mpl-data\fonts\ttf\cmtt10.ttf;
 Cannot_Open_Resource
 
 
 --
 --
 
 --
 ---
 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://sourceforge.net/services/buy/index.php
 
 
 --
 --
 
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users

--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

This message contains confidential information and is intended only
for the individual named.  If you are not the named addressee you
should not disseminate, distribute or copy this e-mail.  Please
notify the sender immediately by e-mail if you have received this
e-mail by mistake and delete this e-mail from your system and destroy 
any copies thereof.

E-mail transmission cannot be guaranteed to be secure or error-free
as information could be intercepted, corrupted, lost, destroyed,
arrive late or incomplete, or contain viruses.  The sender therefore
does not accept liability for any errors or omissions in the contents
of this message which arise as a result of e-mail transmission.  If
verification is required please request a hard-copy version.  This
message is provided for informational purposes and should not be
construed as a solicitation or offer to buy or sell any securities or
related financial instruments.



-
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://sourceforge.net/services/buy/index.php
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] Repeated calls to set_text using TeX formatting results in RuntimeError

2007-12-11 Thread Michael Droettboom
The patch for r4633 is pretty simple, so you could test it without 
needing to check out from SVN or build your own matplotlib etc.

Open the file font_manager.py, which should live in 
%PYTHONPATH%/Lib/site-packages/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...)

Then try your script again.  If that doesn't work, I'll have to fire up 
Windows some time to have a look -- I'm not able to reproduce this bug 
on Linux.

Cheers,
Mike

[EMAIL PROTECTED] wrote:
 I believe this is a known bug with 0.90.1.  Are you able to run
 0.91.1?
 
 
 I just upgraded and checked -- the bug still exists in 0.91.1.  I'm
 afraid I don't know whether it has been fixed by r4633 or not.
 
 Best,
Brian 
 
 
 [EMAIL PROTECTED] wrote:
 I'm doing a parameter fitting exercise, and plotting the progress as I
 
 do so.  I have found that repeated calls to set_text() on a text 
 object will result in an error opening a font file iff the text uses 
 TeX formatting.  (I am not using the experimental usetex feature).

 I speculate that matplotlib is opening the font file anew with each 
 call to set_text and never closing it, resulting ultimately in having 
 too many files open.  Here is a brief program to reproduce this 
 behavior (WinXP, Py2.5, matplotlib 0.90.1):


 from pylab import figure, axes, draw, ion from numpy import array, 
 cos, abs
 ion()
 fig=figure()
 axs=axes()
 x=array(range(100))/10.0
 cosPlot=axs.plot( x, cos(x)**2, 'r' )
 powText = axs.text(0.9,0.02,r'$\alpha=$',

 horizontalalignment='left',verticalalignment='bottom',
 transform = axs.transAxes)
 draw()
 for alpha in array(range(10,400))/100.0:
 axs.lines[-1].set_ydata( abs(cos(x))**alpha)
 powText.set_text(r'$\alpha=%.4g$'%alpha)
 print alpha
 draw()





 Traceback (most recent call last):
   File delme.py, line 16, in module
   File
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matpl
 otlib\pylab.py,
 line 754, in draw
   File
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matpl
 otlib\backends\backend_tkagg.py,
 line 154, in draw

   File
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matpl
 otlib\backends\backend_agg.py,
 line 392, in draw

   File
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matpl
 otlib\figure.py,
 line 601, in draw
   File
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matpl
 otlib\axes.py,
 line 1286, in draw
   File
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matpl
 otlib\text.py,
 line 410, in draw
   File
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matpl
 otlib\text.py,
 line 255, in _get_layout
   File
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matpl
 otlib\backends\backend_agg.py,
 line 246, in get_text_width_height

   File
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matpl
 otlib\mathtext.py,
 line 1569, in __call__
   File
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matpl
 otlib\mathtext.py,
 line 578, in __init__
 RuntimeError: Could not open facefile 
 c:\Python25\lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matplo
 tlib\mpl-data\fonts\ttf\cmtt10.ttf;
 Cannot_Open_Resource


 --
 --

 --
 ---
 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://sourceforge.net/services/buy/index.php


 --
 --

 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 
 --
 Michael Droettboom
 Science Software Branch
 Operations and Engineering Division
 Space Telescope Science Institute
 Operated by AURA for NASA
 
 This message contains confidential information and is intended only
 for the individual named.  If you are not the named addressee you
 should not disseminate, distribute or copy this e-mail.  Please
 notify the sender immediately by e-mail if you have received this
 e-mail by mistake and delete this e-mail from your system and destroy 
 any copies thereof.
 
 E-mail transmission cannot be guaranteed to be secure or error-free
 as information could be intercepted, corrupted, lost, destroyed,
 arrive late or incomplete, or contain viruses.  The sender therefore
 does not accept liability for any errors or omissions in the contents
 of this message which arise as a result of e-mail transmission.  If
 verification is required please request a hard-copy 

Re: [Matplotlib-users] Repeated calls to set_text using TeX formatting results in RuntimeError

2007-12-11 Thread Brian.Boonstra
Michael et al.

  The r4633 patch fixes the problem indeed.  Thanks for your help!!


Brian
 

-Original Message-
From: Michael Droettboom [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, December 11, 2007 10:03 AM
To: Boonstra, Brian
Cc: matplotlib-users@lists.sourceforge.net
Subject: Re: [Matplotlib-users] Repeated calls to set_text using TeX
formatting results in RuntimeError

The patch for r4633 is pretty simple, so you could test it without
needing to check out from SVN or build your own matplotlib etc.

Open the file font_manager.py, which should live in
%PYTHONPATH%/Lib/site-packages/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...)

Then try your script again.  If that doesn't work, I'll have to fire up
Windows some time to have a look -- I'm not able to reproduce this bug
on Linux.

Cheers,
Mike

[EMAIL PROTECTED] wrote:
 I believe this is a known bug with 0.90.1.  Are you able to run
 0.91.1?
 
 
 I just upgraded and checked -- the bug still exists in 0.91.1.  I'm 
 afraid I don't know whether it has been fixed by r4633 or not.
 
 Best,
Brian
 
 
 [EMAIL PROTECTED] wrote:
 I'm doing a parameter fitting exercise, and plotting the progress as 
 I
 
 do so.  I have found that repeated calls to set_text() on a text 
 object will result in an error opening a font file iff the text uses 
 TeX formatting.  (I am not using the experimental usetex feature).

 I speculate that matplotlib is opening the font file anew with each 
 call to set_text and never closing it, resulting ultimately in having

 too many files open.  Here is a brief program to reproduce this 
 behavior (WinXP, Py2.5, matplotlib 0.90.1):


 from pylab import figure, axes, draw, ion from numpy import array, 
 cos, abs
 ion()
 fig=figure()
 axs=axes()
 x=array(range(100))/10.0
 cosPlot=axs.plot( x, cos(x)**2, 'r' ) powText = 
 axs.text(0.9,0.02,r'$\alpha=$',

 horizontalalignment='left',verticalalignment='bottom',
 transform = axs.transAxes)
 draw()
 for alpha in array(range(10,400))/100.0:
 axs.lines[-1].set_ydata( abs(cos(x))**alpha)
 powText.set_text(r'$\alpha=%.4g$'%alpha)
 print alpha
 draw()





 Traceback (most recent call last):
   File delme.py, line 16, in module
   File
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matp
 l
 otlib\pylab.py,
 line 754, in draw
   File
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matp
 l
 otlib\backends\backend_tkagg.py,
 line 154, in draw

   File
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matp
 l
 otlib\backends\backend_agg.py,
 line 392, in draw

   File
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matp
 l
 otlib\figure.py,
 line 601, in draw
   File
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matp
 l
 otlib\axes.py,
 line 1286, in draw
   File
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matp
 l
 otlib\text.py,
 line 410, in draw
   File
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matp
 l
 otlib\text.py,
 line 255, in _get_layout
   File
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matp
 l
 otlib\backends\backend_agg.py,
 line 246, in get_text_width_height

   File
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matp
 l
 otlib\mathtext.py,
 line 1569, in __call__
   File
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matp
 l
 otlib\mathtext.py,
 line 578, in __init__
 RuntimeError: Could not open facefile 
 c:\Python25\lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matpl
 o
 tlib\mpl-data\fonts\ttf\cmtt10.ttf;
 Cannot_Open_Resource


 -
 -
 --

 -
 -
 ---
 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://sourceforge.net/services/buy/index.php


 -
 -
 --

 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 
 --
 Michael Droettboom
 Science Software Branch
 Operations and Engineering Division
 Space Telescope Science Institute
 Operated by AURA for NASA
 
 This message contains confidential information and is intended only 
 for the individual named.  If you are not the named addressee you 
 should not disseminate, distribute or copy this e-mail.  Please notify

 the sender immediately by e-mail if you have received this e-mail by 
 mistake and delete this e-mail from your system and destroy any

Re: [Matplotlib-users] Repeated calls to set_text using TeX formatting results in RuntimeError

2007-12-11 Thread Michael Droettboom
Great.  The forthcoming 0.91.2 release sounds like it will be very 
important to Windows users.

Apologies for introducing this bug in the first place!

Cheers,
Mike

[EMAIL PROTECTED] wrote:
 Michael et al.
 
   The r4633 patch fixes the problem indeed.  Thanks for your help!!
 
 
 Brian
  
 
 -Original Message-
 From: Michael Droettboom [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, December 11, 2007 10:03 AM
 To: Boonstra, Brian
 Cc: matplotlib-users@lists.sourceforge.net
 Subject: Re: [Matplotlib-users] Repeated calls to set_text using TeX
 formatting results in RuntimeError
 
 The patch for r4633 is pretty simple, so you could test it without
 needing to check out from SVN or build your own matplotlib etc.
 
 Open the file font_manager.py, which should live in
 %PYTHONPATH%/Lib/site-packages/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...)
 
 Then try your script again.  If that doesn't work, I'll have to fire up
 Windows some time to have a look -- I'm not able to reproduce this bug
 on Linux.
 
 Cheers,
 Mike
 
 [EMAIL PROTECTED] wrote:
 I believe this is a known bug with 0.90.1.  Are you able to run
 0.91.1?


 I just upgraded and checked -- the bug still exists in 0.91.1.  I'm 
 afraid I don't know whether it has been fixed by r4633 or not.

 Best,
Brian


 [EMAIL PROTECTED] wrote:
 I'm doing a parameter fitting exercise, and plotting the progress as 
 I
 do so.  I have found that repeated calls to set_text() on a text 
 object will result in an error opening a font file iff the text uses 
 TeX formatting.  (I am not using the experimental usetex feature).

 I speculate that matplotlib is opening the font file anew with each 
 call to set_text and never closing it, resulting ultimately in having
 
 too many files open.  Here is a brief program to reproduce this 
 behavior (WinXP, Py2.5, matplotlib 0.90.1):


 from pylab import figure, axes, draw, ion from numpy import array, 
 cos, abs
 ion()
 fig=figure()
 axs=axes()
 x=array(range(100))/10.0
 cosPlot=axs.plot( x, cos(x)**2, 'r' ) powText = 
 axs.text(0.9,0.02,r'$\alpha=$',

 horizontalalignment='left',verticalalignment='bottom',
 transform = axs.transAxes)
 draw()
 for alpha in array(range(10,400))/100.0:
 axs.lines[-1].set_ydata( abs(cos(x))**alpha)
 powText.set_text(r'$\alpha=%.4g$'%alpha)
 print alpha
 draw()





 Traceback (most recent call last):
   File delme.py, line 16, in module
   File
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matp
 l
 otlib\pylab.py,
 line 754, in draw
   File
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matp
 l
 otlib\backends\backend_tkagg.py,
 line 154, in draw

   File
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matp
 l
 otlib\backends\backend_agg.py,
 line 392, in draw

   File
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matp
 l
 otlib\figure.py,
 line 601, in draw
   File
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matp
 l
 otlib\axes.py,
 line 1286, in draw
   File
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matp
 l
 otlib\text.py,
 line 410, in draw
   File
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matp
 l
 otlib\text.py,
 line 255, in _get_layout
   File
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matp
 l
 otlib\backends\backend_agg.py,
 line 246, in get_text_width_height

   File
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matp
 l
 otlib\mathtext.py,
 line 1569, in __call__
   File
 C:\Python25\Lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matp
 l
 otlib\mathtext.py,
 line 578, in __init__
 RuntimeError: Could not open facefile 
 c:\Python25\lib\site-packages\matplotlib-0.90.1-py2.5-win32.egg\matpl
 o
 tlib\mpl-data\fonts\ttf\cmtt10.ttf;
 Cannot_Open_Resource


 -
 -
 --

 -
 -
 ---
 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://sourceforge.net/services/buy/index.php


 -
 -
 --

 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 --
 Michael Droettboom
 Science Software Branch
 Operations and Engineering Division
 Space Telescope Science Institute
 Operated by AURA for NASA

 This message contains confidential information and is intended only 
 for the individual named.  If you are not the named