summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Hupp <adam@hupp.org>2016-03-20 19:14:19 -0700
committerAdam Hupp <adam@hupp.org>2016-03-20 19:14:19 -0700
commitded19e685a85a25ccc41ba7289326c2fb7bb9963 (patch)
tree9c090d13522c28003a9529a07a3ff83986d8d786
parent74f378e4638c357259457e7e19cb598a2e0f8609 (diff)
downloadpython-magic-0.4.11.tar.gz
throw proper exception on each python version0.4.11
-rw-r--r--magic.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/magic.py b/magic.py
index 710023b..c6142a7 100644
--- a/magic.py
+++ b/magic.py
@@ -77,12 +77,9 @@ class Magic:
return self._handle509Bug(e)
def from_file(self, filename):
- """
- Identify the contents of file `filename`
- raises IOError if the file does not exist
- """
- if not os.path.exists(filename):
- raise IOError("File does not exist: " + filename)
+ # raise FileNotFoundException or IOError if the file does not exist
+ with open(filename):
+ pass
with self.lock:
try:
return magic_file(self.cookie, filename)