Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Error saving file (Qt5 backend) #3603

Copy link
Copy link
Closed
@skraelings

Description

@skraelings
Issue body actions

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.