<p dir="auto">Good morning,</p>
<p dir="auto">I just updated matplotlib and noticed an error (probably typo) in the plot-gui.<br>
Using the <code class="notranslate">Save the figure</code>-Button, it returns</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Format &quot;png)')&quot; is not supported."><pre class="notranslate"><code class="notranslate">Format "png)')" is not supported.
</code></pre></div>
<p dir="auto">for every supported format (replace <code class="notranslate">png</code> respectively).</p>
<p dir="auto">Minimal working example:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import matplotlib.pyplot as plt
import numpy as np                                                                                                                  

a = np.arange(6).reshape((3, 2))

plt.plot(a[:,0], a[:,1], '*')

plt.show()"><pre class="notranslate"><code class="notranslate">import matplotlib.pyplot as plt
import numpy as np                                                                                                                  

a = np.arange(6).reshape((3, 2))

plt.plot(a[:,0], a[:,1], '*')

plt.show()
</code></pre></div>
<p dir="auto">Specs: 3.16.1-1-ARCH with matplotlib version 1.4.0 via AUR</p>
<p dir="auto">Thanks in advance!</p>
<p dir="auto">Bug also reported here: <a href="https://bugs.archlinux.org/task/41790" rel="nofollow">https://bugs.archlinux.org/task/41790</a><br>
When clicking on the Save button on the NavigationToolbar, I get an error:<br>
<code class="notranslate">Format "png)')" is not supported. Supported formats: eps, jpeg, jpg, pdf, pgf, png, ps, raw, rgba, svg, svgz, tif, tiff.</code></p>
<p dir="auto">I tracked the bug to be coming from the output of the <code class="notranslate">_getSaveFileName</code> function, that is supposed to be a string but is a tuple in reality. In <code class="notranslate">qt_compat.py</code>, <code class="notranslate">_getSaveFileName</code> links to QtWidgets.QtFileDialog.getSaveFileName.<br>
In pyqt4, this function returns a string, but the doc pyqt4/5 differences says that in pyqt5 the functions returns a tuple (filename, extension), as for <code class="notranslate">getSaveFileNameAndFilter</code> in pyqt4.</p>
<p dir="auto">Commenting line 96 in <code class="notranslate">qt_compat.py</code>  solved the problem, because <code class="notranslate">_getSaveFileName</code> is then correctly defined in line 117 (only returning the first element of the tuple).</p>