help?

Hello,

I wrote a script that loops over some files, plotting them
individually with imshow(). In between each file, the program waits
for user input and then clears/closes the current figure before making
a new one.

Roughly 5-10 files into the loop, the script dies, outputting a loop
of stuff like this until I close the figure:

File "C:\Python25\Lib\site-packages\matplotlib\pyplot.py", line 201, in gcf
  File "C:\Python25\Lib\site-packages\matplotlib\pyplot.py", line 187, in figure
  File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_wxagg.py",
line 120, in new_figure_manager
  File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_wx.py",
line 1302, in __init__
  File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_wxagg.py",
line 39, in _get_toolbar
  File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_wx.py",
line 1593, in __init__
  File "C:\Python25\Lib\site-packages\matplotlib\backend_bases.py",
line 1391, in __init__
  File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_wx.py",
line 1615, in _init_toolbar
  File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_wx.py",
line 1452, in _load_bitmap
  File "C:\Python25\Lib\site-packages\wx-2.8-msw-unicode\wx\_gdi.py",
line 530, in __init__
PyAssertionError: C++ assertion "IsOpened()" failed at
..\..\src\common\ffile.cpp(187) in wxFFile::Seek(): can't seek on
closed file

Alternatively, it occasionally will tell me there are too many files
open. I have checked and all my file operations include a close(). Any
thoughts? I am using wxpython and wxAgg as my backend, with pycrust
(pyshell) on windows XP.

Thanks,
Jack

I also have another gui script where you move a slider around and it
changes the colormap, using

axes.images[0].set_cmap()
figure.canvas.Refresh()

in real time. It works wonderfully most of the time but occasionally
goes crazy, spouting a loop like this:

Traceback (most recent call last):
  File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_wx.py",
line 1352, in _onClose
  File "C:\Python25\Lib\site-packages\matplotlib\_pylab_helpers.py",
line 28, in destroy
  File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_wx.py",
line 1406, in destroy
  File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_wx.py",
line 1365, in Destroy
  File "C:\Python25\Lib\site-packages\wx-2.8-msw-unicode\wx\_core.py",
line 7198, in Yield
wx._core.PyAssertionError: C++ assertion "wxAssertFailure" failed at
..\..\src\msw\app.cpp(680) in wxApp::Yield(): wxYield called
recursively
Traceback (most recent call last):
  File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_wx.py",
line 1111, in _onSize
  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\vera.ttf;
Cannot_Open_Resource

I'm pretty lost about it :slight_smile:

Thanks,
Jack

···

On Jan 17, 2008 6:03 PM, Jack Sankey <jack.sankey@...287...> wrote:

Hello,

I wrote a script that loops over some files, plotting them
individually with imshow(). In between each file, the program waits
for user input and then clears/closes the current figure before making
a new one.

Roughly 5-10 files into the loop, the script dies, outputting a loop
of stuff like this until I close the figure:

File "C:\Python25\Lib\site-packages\matplotlib\pyplot.py", line 201, in gcf
  File "C:\Python25\Lib\site-packages\matplotlib\pyplot.py", line 187, in figure
  File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_wxagg.py",
line 120, in new_figure_manager
  File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_wx.py",
line 1302, in __init__
  File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_wxagg.py",
line 39, in _get_toolbar
  File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_wx.py",
line 1593, in __init__
  File "C:\Python25\Lib\site-packages\matplotlib\backend_bases.py",
line 1391, in __init__
  File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_wx.py",
line 1615, in _init_toolbar
  File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_wx.py",
line 1452, in _load_bitmap
  File "C:\Python25\Lib\site-packages\wx-2.8-msw-unicode\wx\_gdi.py",
line 530, in __init__
PyAssertionError: C++ assertion "IsOpened()" failed at
..\..\src\common\ffile.cpp(187) in wxFFile::Seek(): can't seek on
closed file

Alternatively, it occasionally will tell me there are too many files
open. I have checked and all my file operations include a close(). Any
thoughts? I am using wxpython and wxAgg as my backend, with pycrust
(pyshell) on windows XP.

Thanks,
Jack

What version of matplotlib are you using? Unfortunately, I think this is a known issue in 0.90.1 that manifests itself most severely on Windows. If you still see it with 0.91.2, let us know and I'll probably want some more information from you.

Cheers,
Mike

Jack Sankey wrote:

···

Hello,

I wrote a script that loops over some files, plotting them
individually with imshow(). In between each file, the program waits
for user input and then clears/closes the current figure before making
a new one.

Roughly 5-10 files into the loop, the script dies, outputting a loop
of stuff like this until I close the figure:

File "C:\Python25\Lib\site-packages\matplotlib\pyplot.py", line 201, in gcf
  File "C:\Python25\Lib\site-packages\matplotlib\pyplot.py", line 187, in figure
  File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_wxagg.py",
line 120, in new_figure_manager
  File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_wx.py",
line 1302, in __init__
  File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_wxagg.py",
line 39, in _get_toolbar
  File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_wx.py",
line 1593, in __init__
  File "C:\Python25\Lib\site-packages\matplotlib\backend_bases.py",
line 1391, in __init__
  File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_wx.py",
line 1615, in _init_toolbar
  File "C:\Python25\Lib\site-packages\matplotlib\backends\backend_wx.py",
line 1452, in _load_bitmap
  File "C:\Python25\Lib\site-packages\wx-2.8-msw-unicode\wx\_gdi.py",
line 530, in __init__
PyAssertionError: C++ assertion "IsOpened()" failed at
..\..\src\common\ffile.cpp(187) in wxFFile::Seek(): can't seek on
closed file

Alternatively, it occasionally will tell me there are too many files
open. I have checked and all my file operations include a close(). Any
thoughts? I am using wxpython and wxAgg as my backend, with pycrust
(pyshell) on windows XP.

Thanks,
Jack

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

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