2021-08-05 21:33:18 +00:00
|
|
|
diff --git i/magic/loader.py w/magic/loader.py
|
|
|
|
index 931f161..b8096d1 100644
|
|
|
|
--- i/magic/loader.py
|
|
|
|
+++ w/magic/loader.py
|
|
|
|
@@ -35,16 +35,12 @@ def _lib_candidates():
|
|
|
|
|
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
def load_lib():
|
2021-08-05 21:33:18 +00:00
|
|
|
+ lib = '@libmagic@'
|
|
|
|
|
|
|
|
- for lib in _lib_candidates():
|
|
|
|
- # find_library returns None when lib not found
|
|
|
|
- if lib is None:
|
|
|
|
- continue
|
|
|
|
- try:
|
|
|
|
- return ctypes.CDLL(lib)
|
|
|
|
- except OSError:
|
|
|
|
- pass
|
|
|
|
- else:
|
|
|
|
- # It is better to raise an ImportError since we are importing magic module
|
|
|
|
- raise ImportError('failed to find libmagic. Check your installation')
|
|
|
|
+ try:
|
|
|
|
+ return ctypes.CDLL(lib)
|
|
|
|
+ except OSError:
|
|
|
|
+ pass
|
2021-03-09 03:18:52 +00:00
|
|
|
|
2021-08-05 21:33:18 +00:00
|
|
|
+ # It is better to raise an ImportError since we are importing magic module
|
|
|
|
+ raise ImportError('failed to find libmagic. Check your installation')
|