If we can't import python-magic because libmagic dll is missing on
windows, an WindowsError (winerror) will be thrown.
So handle gracefully this case with a fallback.
... | ... |
@@ -88,7 +88,7 @@ try: |
88 | 88 |
def mime_magic_file(file): |
89 | 89 |
return magic_.file(deunicodise(file)) |
90 | 90 |
|
91 |
-except ImportError as e: |
|
91 |
+except (ImportError, OSError) as e: |
|
92 | 92 |
error_str = str(e) |
93 | 93 |
if 'magic' in error_str: |
94 | 94 |
magic_message = "Module python-magic is not available." |