diff --git a/lib/matplotlib/font_manager.py b/lib/matplotlib/font_manager.py index f41bc56514cf..89eae9f014e2 100644 --- a/lib/matplotlib/font_manager.py +++ b/lib/matplotlib/font_manager.py @@ -965,8 +965,10 @@ def json_dump(data, filename): Handles FontManager and its fields.""" with open(filename, 'w') as fh: - json.dump(data, fh, cls=JSONEncoder, indent=2) - + try: + json.dump(data, fh, cls=JSONEncoder, indent=2) + except IOError as e: + warnings.warn('Could not save font_manager cache ', e) def json_load(filename): """Loads a data structure as JSON from the named file.