8000 Merge pull request #5661 from mdboom/filenotfound-py2 · matplotlib/matplotlib@f9216a6 · GitHub
[go: up one dir, main page]

Skip to content

Commit f9216a6

Browse files
committed
Merge pull request #5661 from mdboom/filenotfound-py2
Fix #5660. No FileNotFoundError on Py2
2 parents a56d588 + 157621b commit f9216a6

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