-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
UnicodeEncodeError when trying to save a figure #4275
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
Comments
I don't know why that @mfitzp: You appear to be the last major contributor to the Qt stuff. Do you see any downside to just removing the |
This exists for compatibility with "version 1" of the PyQt(4) API. In this version the APIs return There is some more information on the Riverbank docs for PyQt4. It notes that v2 of the API is default for Python 3 (I also think it is the default for matplotlib generally in PyQt4). In PyQt5 this distinction doesn't exist. I guess there are a few options:
What do you think? |
The following replacement could be made on a subclassed Qt4 version of
Let me know if this looks OK and I'll put together a PR. |
Thanks. The fact that this is also used for the save figure path was forgotten, so wasn't included in my testing where I said "everything worked". In that event, actually none of the alternatives work (Qt4 old/new, PySide, Qt5) work on Python 2.7. So it looks like what you propose above work work either. Just to confirm, when you say set This works for me:
Having issues getting a Python 3 / Qt environment set up, so I haven't tested there. |
The above code would be used in addition to removing the You're right that setting
It should return |
Yes -- using |
I've opened a PR with the suggested fix. Testing here it works fine, but also unable to test with Python 3 yet, will look into it. When applying the fix I noticed there were a few other incidences of |
Thank you for your reactivity everyone, it is much appreciated ! |
Run the following code under python2, then try to save the figure but clicking on the floppy button :
The window for choosing a filename doesn't open and this traceback is printed:
It works fine on python3.
The text was updated successfully, but these errors were encountered: