Skip to content

Commit b8a1284

Browse files
authored
Merge pull request #9679 from matplotlib/auto-backport-of-pr-9676
Backport PR #9676 on branch v2.1.x
2 parents f1e75cb + 08cf3b1 commit b8a1284

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/matplotlib/font_manager.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -965,8 +965,10 @@ def json_dump(data, filename):
965965
Handles FontManager and its fields."""
966966

967967
with open(filename, 'w') as fh:
968-
json.dump(data, fh, cls=JSONEncoder, indent=2)
969-
968+
try:
969+
json.dump(data, fh, cls=JSONEncoder, indent=2)
970+
except IOError as e:
971+
warnings.warn('Could not save font_manager cache ', e)
970972

971973
def json_load(filename):
972974
"""Loads a data structure as JSON from the named file.

0 commit comments

Comments
 (0)