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

Skip to content

Commit 799fc9f

Browse files
authored
Merge pull request #13677 from anntzer/logfontpropfailures
Log all failures to extract font properties.
2 parents 9dffae9 + bc5bfec commit 799fc9f

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
@@ -529,23 +529,25 @@ def createFontList(fontfiles, fontext='ttf'):
529529
continue
530530
try:
531531
prop = afmFontProperty(fpath, font)
532-
except KeyError:
532+
except KeyError as exc:
533+
_log.info("Could not extract properties for %s: %s",
534+
fpath, exc)
533535
continue
534536
else:
535537
try:
536538
font = ft2font.FT2Font(fpath)
537-
except RuntimeError:
538-
_log.info("Could not open font file %s", fpath)
539+
except (OSError, RuntimeError) as exc:
540+
_log.info("Could not open font file %s: %s", fpath, exc)
539541
continue
540542
except UnicodeError:
541543
_log.info("Cannot handle unicode filenames")
542544
continue
543-
except OSError:
544-
_log.info("IO error - cannot open font file %s", fpath)
545-
continue
546545
try:
547546
prop = ttfFontProperty(font)
548-
except (KeyError, RuntimeError, ValueError, NotImplementedError):
547+
except (KeyError, RuntimeError, ValueError,
548+
NotImplementedError) as exc:
549+
_log.info("Could not extract properties for %s: %s",
550+
fpath, exc)
549551
continue
550552

551553
fontlist.append(prop)

0 commit comments

Comments
 (0)