We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d2a23c8 commit dbc7033Copy full SHA for dbc7033
openslide/lowlevel.py
@@ -38,7 +38,17 @@
38
if platform.system() == 'Windows':
39
_lib = cdll.LoadLibrary('libopenslide-0.dll')
40
elif platform.system() == 'Darwin':
41
- _lib = cdll.LoadLibrary('libopenslide.0.dylib')
+ try:
42
+ _lib = cdll.LoadLibrary('libopenslide.0.dylib')
43
+ except OSError:
44
+ # MacPorts doesn't add itself to the dyld search path, but
45
+ # does add itself to the find_library() search path
46
+ # (DEFAULT_LIBRARY_FALLBACK in ctypes.macholib.dyld).
47
+ import ctypes.util
48
+ _lib = ctypes.util.find_library('openslide')
49
+ if _lib is None:
50
+ raise ImportError("Couldn't locate OpenSlide library")
51
+ _lib = cdll.LoadLibrary(_lib)
52
else:
53
_lib = cdll.LoadLibrary('libopenslide.so.0')
54
0 commit comments