Browse Source

Python2 compatibility.

Jelmer Vernooij 5 years ago
parent
commit
24dcd78c89
1 changed files with 5 additions and 2 deletions
  1. 5 2
      dulwich/lfs.py

+ 5 - 2
dulwich/lfs.py

@@ -18,6 +18,7 @@
 # License, Version 2.0.
 #
 
+import errno
 import hashlib
 import os
 import tempfile
@@ -51,8 +52,10 @@ class LFSStore(object):
         """Open an object by sha."""
         try:
             return open(self._sha_path(sha), 'rb')
-        except FileNotFoundError:
-            raise KeyError(sha)
+        except (OSError, IOError) as e:
+            if e.errno == errno.ENOENT:
+                raise KeyError(sha)
+            raise
 
     def write_object(self, chunks):
         """Write an object.