-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Bug with font finding, and here is my fix as well. #12406
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
Calling |
notice that in case of the first try: in above code, that the code also didn't provide fonts cause a non existing registrykey 'fontdir' , So fontdir was passed trough (didnt exist in regsitry at all) and that would erase the entire item list. some how a wrong registry path was givven suposendly having fonts, well not on my win 10 system the regkey didnt exist., the other key (first in for) did exist though, but because of try catch code in between got ignored (Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Fonts) didnt exist the other key found by the code did exist, but the whole block of code got ignored (crashed on missing file as well) in the way try catch was setup. Two errors caused the problems, a wrong registy key, and some font files not existing. |
Ah, I see, this changed in Py3.6:
in 3.5 this was
So the fix seems fine but the except clause should specifically just catch FileNotFoundError and RuntimeError (on 3.6, just RuntimeError). |
i'm not coding that long in python just a few days days or so English is not my first language, so i hope my bug cause explanation was clear. |
Sure, I'll do it. |
maybe a small side note, that it seamed strange to me that only lowercase font extensions where added in the old code. It doesnt violate windows if WINDINGS2.TTF was used besides windings.ttf |
That was already reported and fixed elsewhere. |
Bug report
font_manager crashes with font not found errors,
Bug summary
there is an Issue allready for this, but after i fixed it i couldnt find that issue back as when i fixed it my errors where gone .
Some error about font not found
Code for reproduction
from matplotlib.font_manager import win32InstalledFonts
print(win32InstalledFonts())
Matplotlib version
print(matplotlib.get_backend())
):Conda default
Here is my fix:
Essentially problems are caused because the registry does not really reflect all the fonts, that was the reasons Path(directory,direc).resolve() crashed, so placed it inside another try excerpt and it now works.
The point here is registry does not reflect the file system, people can remove software in wild ways.
i left a commented option to show the missing files in the excerpt.
Its fixed now so i hope other people with the same issues can be happy and go coding now :),
its my first python opensource contribution
The text was updated successfully, but these errors were encountered: