From c128cb06819832929f96122beb567f23b0d7aa99 Mon Sep 17 00:00:00 2001 From: jwijenbergh Date: Wed, 29 Jun 2022 16:04:48 +0200 Subject: Python: Load normal library path before loading absolute path --- wrappers/python/src/__init__.py | 11 +++++++++-- 1 file 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): -- cgit v1.2.3