Skip to content

Backport PR #12448 on branch v3.0.x (Don't error if some font directories are not readable.) #12484

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

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions lib/matplotlib/font_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,11 @@ def list_fonts(directory, extensions):
recursively under the directory.
"""
extensions = ["." + ext for ext in extensions]
return [str(path)
for path in filter(Path.is_file, Path(directory).glob("**/*.*"))
if path.suffix.lower() in extensions]
return [os.path.join(dirpath, filename)
# os.walk ignores access errors, unlike Path.glob.
for dirpath, _, filenames in os.walk(directory)
for filename in filenames
if Path(filename).suffix.lower() in extensions]


def win32FontDirectory():
Expand Down