summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2022-06-29 16:04:48 +0200
committerjwijenbergh <jeroenwijenbergh@protonmail.com>2022-06-29 16:04:48 +0200
commitc128cb06819832929f96122beb567f23b0d7aa99 (patch)
tree89f0f397de0f6bbc3f48cb026fdd527b6c068952
parent8fbe53fb2f90ca7c7410621581abca35bc3e749c (diff)
Python: Load normal library path before loading absolute path
-rw-r--r--wrappers/python/src/__init__.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/wrappers/python/src/__init__.py b/wrappers/python/src/__init__.py
index 8129495..1ec0bec 100644
--- a/wrappers/python/src/__init__.py
+++ b/wrappers/python/src/__init__.py
@@ -23,8 +23,15 @@ _os = platform.system().lower()
_libname = "eduvpn_common"
_libfile = f"{_lib_prefixes[_os]}{_libname}{_lib_suffixes[_os]}"
-# Library should have been copied to the lib/ folder
-lib = cdll.LoadLibrary(str(pathlib.Path(__file__).parent / "lib" / _libfile))
+
+lib = None
+
+# Try to load in the normal path
+try:
+ lib = cdll.LoadLibrary(_libfile)
+# Otherwise, library should have been copied to the lib/ folder
+except:
+ lib = cdll.LoadLibrary(str(pathlib.Path(__file__).parent / "lib" / _libfile))
class DataError(Structure):