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 5552302

Browse filesBrowse files
tacaswellmeeseeksmachine
authored andcommitted
Backport PR #28498: Don't fail if we can't query system fonts on macOS
1 parent f76bba4 commit 5552302
Copy full SHA for 5552302

File tree

1 file changed

+5
-2
lines changed
Filter options

1 file changed

+5
-2
lines changed

‎lib/matplotlib/font_manager.py

Copy file name to clipboardExpand all lines: lib/matplotlib/font_manager.py
+5-2Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,11 @@ def _get_fontconfig_fonts():
266266
@lru_cache
267267
def _get_macos_fonts():
268268
"""Cache and list the font paths known to ``system_profiler SPFontsDataType``."""
269-
d, = plistlib.loads(
270-
subprocess.check_output(["system_profiler", "-xml", "SPFontsDataType"]))
269+
try:
270+
d, = plistlib.loads(
271+
subprocess.check_output(["system_profiler", "-xml", "SPFontsDataType"]))
272+
except (OSError, subprocess.CalledProcessError, plistlib.InvalidFileException):
273+
return []
271274
return [Path(entry["path"]) for entry in d["_items"]]
272275

273276

0 commit comments

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