I keep getting error in sys.exitfunc when working with matplotlib. For example, the following code drop it for matplotlib 1.3.0 / Python 2.7.3 / Ubuntu 12.04.3 LTS
from matplotlib.pyplot import figure, show from numpy.random import random fh = figure(figsize = (15, 10, )) ax = fh.add_axes((.1, .1, .8, .8, )) ax.scatter(random((100, )), random((100, ))) fh.show()
This gives
Error in atexit._run_exitfuncs: Traceback (most recent call last): File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs func(*targs, **kargs) File "/usr/local/lib/python2.7/dist-packages/matplotlib/_pylab_helpers.py", line 86, in destroy_all manager.destroy() File "/usr/local/lib/python2.7/dist-packages/matplotlib/backends/backend_gtk3.py", line 427, in destroy self.canvas.destroy() AttributeError: FigureManagerGTK3Agg instance has no attribute 'canvas' Error in sys.exitfunc: Traceback (most recent call last): File "/usr/lib/python2.7/atexit.py", line 24, in _run_exitfuncs func(*targs, **kargs) File "/usr/local/lib/python2.7/dist-packages/matplotlib/_pylab_helpers.py", line 86, in destroy_all manager.destroy() File "/usr/local/lib/python2.7/dist-packages/matplotlib/backends/backend_gtk3.py", line 427, in destroy self.canvas.destroy() AttributeError: FigureManagerGTK3Agg instance has no attribute 'canvas'
This happens at any time when the program ends without show() , including when an unrelated error occurs.
If I use show() instead of fh.show() , I do not get this error. I could just do it, but this error appears in many places, and I prefer to just solve it (and I want you to be able to exit without showing a number).
I tried other backends that are either inaccessible, or do not show, or give the same error (this is GKT3Agg).