Skip to content

Commit f4be473

Browse files
committed
Don't error if some font directories are not readable.
1 parent 9cffe0e commit f4be473

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/matplotlib/font_manager.py

+5-3
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)