-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Change win32InstalledFonts return value #12213
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
Conversation
There is already #12174, however it did not add an api change entry. |
Oh, didn't see #12174. The discussion there has gone a bit off-topic as well. Anyway, we should add an API change note. While it's unlikely that someone will actually use that function and have a problem with the change, it's still a function that appears in the official docs. |
0c6ae93
to
deae70a
Compare
Taking up the solution proposed by @Kojoley in #12173 (comment) |
I don't know if this is allowed or not, I'm a complete novice when it comes to Python, and libraries, imports. What I can say is I had this problem, ended up here after having to do an environment reload which updated my matplotlib. You guys are amazing, checked out the file update, made the modifications, back up and running. |
The solution proposed by @Kojoley in #12173 did not solve the issue for me, I still get
|
@sebbosafened Hm, I do not know how it is even possible to get a
Please, check twice, the line number should be different. matplotlib/lib/matplotlib/font_manager.py Line 261 in deae70a
|
I copied everything from your version of matplotlib/lib/matplotlib/font_manager.py Line 261 in deae70a
font_manager.py (after backing up my local version that I had already edited - with obvious mistakes - according to yourt post @Kojoley on 23rd september, 00:16 CEST) and now it works. Thank you a lot.
|
Somehow the contents of |
I change "if sys.platform == 'win32:" to if sys.platform == 'win64': in matplotlib/lib/matplotlib/font_manager.py |
It cannot has that value https://mail.python.org/pipermail/patches/2000-May/000648.html |
It works for me! Thanks a lot 🎉🎉🎉 |
PR Summary
In the context of #12173 it was noted that
matplotlib.font_manager.win32InstalledFonts()
returned None if no fonts are found. This is inconsistent with the docs which claims that a list of fonts is returned. This PR changes the return value to an empty list, which is a more natural choice and is more convenient than the None value. If the value can be None, we have to explicitly check before doing any list-operations on the return value. An empty list can be handled more gracefully.Returning an empty list is also the behavior of
OSXInstalledFonts()
.This is in principle a breaking API change. However, I think it's ok to document it and apply it right away.
Note: this fixes one of the exceptions in #12173:
PR Checklist