Skip to content

Commit

Permalink
Merge pull request #28499 from meeseeksmachine/auto-backport-of-pr-28…
Browse files Browse the repository at this point in the history
…498-on-v3.9.x

Backport PR #28498 on branch v3.9.x (Don't fail if we can't query system fonts on macOS)
  • Loading branch information
QuLogic authored Jul 3, 2024
2 parents f76bba4 + 5552302 commit 560fdc4
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 560fdc4

Please sign in to comment.