figure error during python shutdown

There seems to be an odd error that comes up when exiting python after using matplotlib with gtkagg backend. I only notice this error if I do not display the figure (i.e., only saving figures in a headless mode) and during the test. Also, this is with matplotlib master branch. I have not tested this with any other branch. Here is the error message:

Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File “/usr/lib/python2.6/atexit.py”, line 24, in _run_exitfuncs
func(*targs, **kargs)
File “/home/bvr/Programs/matplotlib/lib/matplotlib/_pylab_helpers.py”, line 82, in destroy_all

manager.destroy()

File “/home/bvr/Programs/matplotlib/lib/matplotlib/backends/backend_gtk.py”, line 552, in destroy
self.canvas.destroy()
AttributeError: FigureManagerGTKAgg instance has no attribute ‘canvas’

Error in sys.exitfunc:
Traceback (most recent call last):
File “/usr/lib/python2.6/atexit.py”, line 24, in _run_exitfuncs
func(*targs, **kargs)
File “/home/bvr/Programs/matplotlib/lib/matplotlib/_pylab_helpers.py”, line 82, in destroy_all

manager.destroy()

File “/home/bvr/Programs/matplotlib/lib/matplotlib/backends/backend_gtk.py”, line 552, in destroy
self.canvas.destroy()
AttributeError: FigureManagerGTKAgg instance has no attribute ‘canvas’

This happens with both python 2.6 and 2.7. I have not tested any other version.

Ben Root

I think this might have existed for a long time, but there just hasn’t
been much testing running Gtk without opening windows.

There is a fix in this pull request.

Can you confirm it works for you?
Mike

···

https://github.com/matplotlib/matplotlib/pull/106

There seems to be an odd error that comes up when exiting python after
using matplotlib with gtkagg backend. I only notice this error if I do
not display the figure (i.e., only saving figures in a headless mode)
and during the test. Also, this is with matplotlib master branch. I
have not tested this with any other branch. Here is the error message:

Error in atexit._run_exitfuncs:

Traceback (most recent call last):

File “/usr/lib/python2.6/atexit.py”, line 24, in _run_exitfuncs

func(*targs, **kargs)

File
“/home/bvr/Programs/matplotlib/lib/matplotlib/_pylab_helpers.py”, line
82, in destroy_all

manager.destroy()

File
“/home/bvr/Programs/matplotlib/lib/matplotlib/backends/backend_gtk.py”,
line 552, in destroy

self.canvas.destroy()

AttributeError: FigureManagerGTKAgg instance has no attribute ‘canvas’

Error in sys.exitfunc:

Traceback (most recent call last):

File “/usr/lib/python2.6/atexit.py”, line 24, in _run_exitfuncs

func(*targs, **kargs)

File
“/home/bvr/Programs/matplotlib/lib/matplotlib/_pylab_helpers.py”, line
82, in destroy_all

manager.destroy()

File
“/home/bvr/Programs/matplotlib/lib/matplotlib/backends/backend_gtk.py”,
line 552, in destroy

self.canvas.destroy()

AttributeError: FigureManagerGTKAgg instance has no attribute ‘canvas’

This happens with both python 2.6 and 2.7. I have not tested any other
version.

Ben Root



WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network management toolset available today. Delivers lowest initial acquisition cost and overall TCO of any competing solution.


Matplotlib-devel mailing list
http://p.sf.net/sfu/whatsupgold-sd


Matplotlib-devel@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/matplotlib-devel

-- Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA

Michael Droettboom-3 wrote:

There is a fix in this pull request.

Gtk crash by mdboom · Pull Request #106 · matplotlib/matplotlib · GitHub

Can you confirm it works for you?

For me that only moved the problem further a little, I got the error:

AttributeError: FigureManagerGTKAgg instance has no attribute 'toolbar'

Which was solved by changing the line after your fix to be:

if hasattr(self, 'toolbar') and self.toolbar:

This then seems to run fine.

···

--
View this message in context: http://old.nabble.com/figure-error-during-python-shutdown-tp31554255p31565516.html
Sent from the matplotlib - devel mailing list archive at Nabble.com.