Skip to content

Commit ded19e6

Browse files
committed
throw proper exception on each python version
1 parent 74f378e commit ded19e6

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

magic.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,9 @@ def from_buffer(self, buf):
7777
return self._handle509Bug(e)
7878

7979
def from_file(self, filename):
80-
"""
81-
Identify the contents of file `filename`
82-
raises IOError if the file does not exist
83-
"""
84-
if not os.path.exists(filename):
85-
raise IOError("File does not exist: " + filename)
80+
# raise FileNotFoundException or IOError if the file does not exist
81+
with open(filename):
82+
pass
8683
with self.lock:
8784
try:
8885
return magic_file(self.cookie, filename)

0 commit comments

Comments
 (0)