Browse code

Fix #922 - Handle libmagic missing on windows

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.

Florent Viard authored on 2017/10/12 06:39:26
Showing 1 changed files
... ...
@@ -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."