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

Skip to content

Commit 053e1a8

Browse files
committed
Merge pull request #5661 from mdboom/filenotfound-py2
Fix #5660. No FileNotFoundError on Py2
1 parent dfadd4d commit 053e1a8

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

lib/matplotlib/dviread.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,11 @@ def _fnt_def(self, k, c, s, d, a, l, n):
387387
fontname = n[-l:].decode('ascii')
388388
tfm = _tfmfile(fontname)
389389
if tfm is None:
390-
raise FileNotFoundError("missing font metrics file: %s" % fontname)
390+
if six.PY2:
391+
error_class = OSError
392+
else:
393+
error_class = FileNotFoundError
394+
raise error_class("missing font metrics file: %s" % fontname)
391395
if c != 0 and tfm.checksum != 0 and c != tfm.checksum:
392396
raise ValueError('tfm checksum mismatch: %s'%n)
393397

0 commit comments

Comments
 (0)