8000 Fix #5660. No FileNotFoundError on Py2 · matplotlib/matplotlib@157621b · GitHub
[go: up one dir, main page]

Skip to content

Commit 157621b

Browse files
committed
Fix #5660. No FileNotFoundError on Py2
1 parent bdb8450 commit 157621b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/matplotlib/dviread.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,11 @@ def _fnt_def_real(self, k, c, s, d, a, l):
451451
fontname = n[-l:].decode('ascii')
452452
tfm = _tfmfile(fontname)
453453
if tfm is None:
454-
raise FileNotFoundError("missing font metrics file: %s" % fontname)
454+
if six.PY2:
455+
error_class = OSError
456+
else:
457+
error_class = FileNotFoundError
458+
raise error_class("missing font metrics file: %s" % fontname)
455459
if c != 0 and tfm.checksum != 0 and c != tfm.checksum:
456460
raise ValueError('tfm checksum mismatch: %s' % n)
457461

0 commit comments

Comments
 (0)
0