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

Commit 4afcaac

Browse filesBrowse files
committed
Don't error if some font directories are not readable.
1 parent 9cffe0e commit 4afcaac
Copy full SHA for 4afcaac

File tree

Expand file treeCollapse file tree

1 file changed

+5
-3
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-3
lines changed

‎lib/matplotlib/font_manager.py

Copy file name to clipboardExpand all lines: lib/matplotlib/font_manager.py
+5-3Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,11 @@ def list_fonts(directory, extensions):
152152
recursively under the directory.
153153
"""
154154
extensions = ["." + ext for ext in extensions]
155-
return [str(path)
156-
for path in filter(Path.is_file, Path(directory).glob("**/*.*"))
157-
if path.suffix.lower() in extensions]
155+
return [filename
156+
# os.walk ignores access errors, unlike Path.glob.
157+
for _, _, filenames in os.walk(directory)
158+
for filename in filenames
159+
if Path(filename).suffix.lower() in extensions]
158160

159161

160162
def win32FontDirectory():

0 commit comments

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