From ac20f766356b12ce3bbd82dda0b2a5da182f663f Mon Sep 17 00:00:00 2001 From: greg-roper Date: Wed, 5 Oct 2016 17:08:33 +0100 Subject: [PATCH] Catch IO errors when building font cache Problem seen on Windows machines where permission was denied when trying to load specific fonts (DINpro Light). --- lib/matplotlib/font_manager.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/matplotlib/font_manager.py b/lib/matplotlib/font_manager.py index 1d0ba8377148..f9cfb1600cb6 100644 --- a/lib/matplotlib/font_manager.py +++ b/lib/matplotlib/font_manager.py @@ -591,6 +591,9 @@ def createFontList(fontfiles, fontext='ttf'): verbose.report("Cannot handle unicode filenames") # print >> sys.stderr, 'Bad file is', fpath continue + except IOError: + verbose.report("IO error - cannot open font file %s" % fpath) + continue try: prop = ttfFontProperty(font) except (KeyError, RuntimeError, ValueError):