blob: 883f1edc8be02a56a08df3e478651d377cfb0fe0 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
--- a/lib/matplotlib/font_manager.py
+++ b/lib/matplotlib/font_manager.py
@@ -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"]]
|