10000 Do not error on font-cache write error · matplotlib/matplotlib@f4ac036 · GitHub
[go: up one dir, main page]

Skip to content

Commit f4ac036

Browse files
committed
Do not error on font-cache write error
1 parent 14216a9 commit f4ac036

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/matplotlib/font_manager.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -964,8 +964,11 @@ def json_dump(data, filename):
964964
Handles FontManager and its fields."""
965965

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

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

0 commit comments

Comments
 (0)
0