Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bc5bfec

Browse files
committed
Log all failures to extract font properties.
Some failures were previously not logged.
1 parent 093d582 commit bc5bfec

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

lib/matplotlib/font_manager.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -531,23 +531,25 @@ def createFontList(fontfiles, fontext='ttf'):
531531
continue
532532
try:
533533
prop = afmFontProperty(fpath, font)
534-
except KeyError:
534+
except KeyError as exc:
535+
_log.info("Could not extract properties for %s: %s",
536+
fpath, exc)
535537
continue
536538
else:
537539
try:
538540
font = ft2font.FT2Font(fpath)
539-
except RuntimeError:
540-
_log.info("Could not open font file %s", fpath)
541+
except (OSError, RuntimeError) as exc:
542+
_log.info("Could not open font file %s: %s", fpath, exc)
541543
continue
542544
except UnicodeError:
543545
_log.info("Cannot handle unicode filenames")
544546
continue
545-
except OSError:
546-
_log.info("IO error - cannot open font file %s", fpath)
547-
continue
548547
try:
549548
prop = ttfFontProperty(font)
550-
except (KeyError, RuntimeError, ValueError, NotImplementedError):
549+
except (KeyError, RuntimeError, ValueError,
550+
NotImplementedError) as exc:
551+
_log.info("Could not extract properties for %s: %s",
552+
fpath, exc)
551553
continue
552554

553555
fontlist.append(prop)

0 commit comments

Comments
 (0)