<!--To help us understand and resolve your issue, please fill out the form to the best of your ability.--> <!--You can feel free to delete the sections that do not apply.--> ### Bug report Saving `.png` files is currently failing on the osx backend. I'm guessing this is due to #6603 (see the error message below) <!--A short 1-2 sentences that succinctly describes the bug--> **Code for reproduction** <!--A minimum code snippet required to reproduce the bug, also minimizing the number of dependencies required--> ```python import matplotlib matplotlib.use('MacOSX') import matplotlib.pyplot as plt fig, ax = plt.subplots() fig.savefig('test.png') ``` **Actual outcome** <!--The output produced by the above code, which may be a screenshot, console output, etc.--> ```python File "test.py", line 6, in <module> fig.savefig('test.png') File "/Users/dstansby/github/matplotlib/lib/matplotlib/figure.py", line 1813, in savefig self.canvas.print_figure(fname, **kwargs) File "/Users/dstansby/github/matplotlib/lib/matplotlib/backend_bases.py", line 2258, in print_figure **kwargs) File "/Users/dstansby/github/matplotlib/lib/matplotlib/backends/backend_agg.py", line 507, in print_png FigureCanvasAgg.draw(self) File "/Users/dstansby/github/matplotlib/lib/matplotlib/backends/backend_agg.py", line 429, in draw toolbar.set_cursor(cursors.WAIT) File "/Users/dstansby/github/matplotlib/lib/matplotlib/backends/backend_macosx.py", line 188, in set_cursor _macosx.set_cursor(cursor) SystemError: <built-in function set_cursor> returned NULL without setting an error ``` **Expected outcome** <!--A description of the expected outcome from the code snippet--> <!--If this used to work in an earlier version of Matplotlib, please note the version it used to work on--> **Matplotlib version** <!--Please specify your platform and versions of the relevant libraries you are using:--> * Operating System: OSX * Matplotlib Version: Current master branch installed using pip * Python Version: 3.6.2 <!--Please tell us how you installed matplotlib and python e.g., from source, pip, conda--> <!--If you installed from conda, please specify which channel you used if not the default-->
Activity
jenshnielsen commentedon Sep 5, 2017
I can reproduce this with 2.1rc1 Agreed that this is release critical
anntzer commentedon Sep 5, 2017
The offending section is in
_macosx.matwhich just seems to be poorly written code (indeed you need to set an exception if you're going to return NULL, see https://docs.python.org/3.6/c-api/exceptions.html#c.PyErr_SetString). In any case, cursors.WAIT is equal to 4 (see backend_tools.py) and it would seem to one only needs to add a case to the switch, but...
https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/CursorMgmt/Tasks/ChangingCursors.html
I guess if OSX knows better than you then we should just do nothing in that case (
case 4: break;).dstansby commentedon Sep 5, 2017
Thanks @anntzer !
tacaswell commentedon Sep 18, 2017
closed by #9157