Skip to content

Commit

Permalink
Backport PR matplotlib#28498: Don't fail if we can't query system fon…
Browse files Browse the repository at this point in the history
…ts on macOS
  • Loading branch information
tacaswell authored and meeseeksmachine committed Jul 2, 2024
1 parent f76bba4 commit 5552302
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/matplotlib/font_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,11 @@ def _get_fontconfig_fonts():
@lru_cache
def _get_macos_fonts():
"""Cache and list the font paths known to ``system_profiler SPFontsDataType``."""
d, = plistlib.loads(
subprocess.check_output(["system_profiler", "-xml", "SPFontsDataType"]))
try:
d, = plistlib.loads(
subprocess.check_output(["system_profiler", "-xml", "SPFontsDataType"]))
except (OSError, subprocess.CalledProcessError, plistlib.InvalidFileException):
return []
return [Path(entry["path"]) for entry in d["_items"]]


Expand Down

0 comments on commit 5552302

Please sign in to comment.