Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error saving file (Qt5 backend) #3603

Closed
skraelings opened this issue Oct 1, 2014 · 3 comments
Closed

Error saving file (Qt5 backend) #3603

skraelings opened this issue Oct 1, 2014 · 3 comments

Comments

@skraelings
Copy link

OS: Archlinux
Python: 2.7.8
PyQt bindings: 5.3.2-1
Qt: 5.3.2-1
Matplotlib: 1.4.0-2

Steps to reproduce:

from matplotlib import pyplot as plt
y_data = [....]
plt.plot(y_data, 'k+')
plt.show()

then press the "Save the figure" icon, it shows the dialog to write a filename. Then press Save, a model error window will pop-up complaining that "png)')" is not a supporte file extension.

Digging further in matplotlib/backend_bases.py (~2098) tries to resolve the extension by

        if cbook.is_string_like(filename):
            format = os.path.splitext(filename)[1][1:]

but filename is this unicode:
u"(u'/home/rbm/figure_1.png', u'Portable Network Graphics (*.png)')"

This in turn comes from the qt5 backend filters passed in method save_fig of matplotlib/backends/backend_qt5.py :
Encapsulated Postscript (.eps);;Joint Photographic Experts Group (.jpeg .jpg);;PGF code for LaTeX (.pgf);;Portable Document Format (.pdf);;Portable Network Graphics (.png);;Postscript (.ps);;Raw RGBA bitmap (.raw .rgba);;Scalable Vector Graphics (.svg .svgz);;Tagged Image File Format (.tif *.tiff)

This will fail for every other format whatever choosed in the Save File dialog.
I tested the GTK backend and it doesn't have this problem.

@WeatherGod
Copy link
Member

IIRC, this was fixed shortly after 1.4.0 and we are putting out a bugfix
release very soon (I think we are tagging the release candidate today).

On Wed, Oct 1, 2014 at 4:37 PM, skraelings notifications@github.com wrote:

OS: Archlinux
Python: 2.7.8
PyQt bindings: 5.3.2-1
Qt: 5.3.2-1
Matplotlib: 1.4.0-2

Steps to reproduce:

from matplotlib import pyplot as plt
y_data = [....]
plt.plot(y_data, 'k+')
plt.show()

then press the "Save the figure" icon, it shows the dialog to write a
filename. Then press Save, a model error window will pop-up complaining
that "png)')" is not a supporte file extension.

Digging further in matplotlib/backend_bases.py (~2098) tries to resolve
the extension by

    if cbook.is_string_like(filename):
        format = os.path.splitext(filename)[1][1:]

but filename is this unicode:
u"(u'/home/rbm/figure_1.png', u'Portable Network Graphics (*.png)')"

This in turn come from the qt5 backend filters:
Encapsulated Postscript (.eps);;Joint Photographic Experts Group (.jpeg .jpg);;PGF
code for LaTeX (
.pgf);;Portable Document Format (.pdf);;Portable
Network Graphics (
.png);;Postscript (.ps);;Raw RGBA bitmap (.raw .rgba);;Scalable
Vector Graphics (
.svg .svgz);;Tagged Image File Format (.tif *.tiff)

This will fail for every other format whatever choose in the save dialog.
I tested the GTK backend and it doesn't have this problem.


Reply to this email directly or view it on GitHub
#3603.

@tacaswell
Copy link
Member

Yes, this is a duplicate of #3454 fixed in #3469 .

There are two outstanding issues #3564 needs to be reviewed/merged (assuming I have unbroken building the docs) and #3517 which we are having trouble reproducing.

@skraelings
Copy link
Author

Great! Didn't look hard enough to see if this was already reported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants