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 9ce5eb4

Browse filesBrowse files
authored
Merge pull request #12448 from anntzer/listfonts-accesserror
Don't error if some font directories are not readable.
2 parents eecd930 + f4be473 commit 9ce5eb4
Copy full SHA for 9ce5eb4

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 [os.path.join(dirpath, filename)
156+
# os.walk ignores access errors, unlike Path.glob.
157+
for dirpath, _, 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.