diff options
| author | Adam Hupp <adam@hupp.org> | 2016-03-20 19:14:19 -0700 |
|---|---|---|
| committer | Adam Hupp <adam@hupp.org> | 2016-03-20 19:14:19 -0700 |
| commit | ded19e685a85a25ccc41ba7289326c2fb7bb9963 (patch) | |
| tree | 9c090d13522c28003a9529a07a3ff83986d8d786 | |
| parent | 74f378e4638c357259457e7e19cb598a2e0f8609 (diff) | |
| download | python-magic-0.4.11.tar.gz | |
throw proper exception on each python version0.4.11
| -rw-r--r-- | magic.py | 9 |
1 files changed, 3 insertions, 6 deletions
@@ -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) |
