summaryrefslogtreecommitdiff
path: root/python_bindings_example.py
diff options
context:
space:
mode:
Diffstat (limited to 'python_bindings_example.py')
-rwxr-xr-xpython_bindings_example.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/python_bindings_example.py b/python_bindings_example.py
index 7bb806c..7911846 100755
--- a/python_bindings_example.py
+++ b/python_bindings_example.py
@@ -41,16 +41,23 @@ def get_library():
C = None
import os, sys
path_build = os.path.join(".", "build")
- paths = [ os.path.join(path_build,"libnitrokey-log.so"),
- os.path.join(path_build,"libnitrokey.so")]
+ paths = [
+ os.environ.get('LIBNK_PATH', None),
+ os.path.join(path_build,"libnitrokey.so"),
+ os.path.join(path_build,"libnitrokey.dylib"),
+ os.path.join(path_build,"libnitrokey.dll"),
+ os.path.join(path_build,"nitrokey.dll"),
+ ]
for p in paths:
- print p
+ if not p: continue
+ print("Trying " +p)
+ p = os.path.abspath(p)
if os.path.exists(p):
+ print("Found: "+p)
C = ffi.dlopen(p)
break
else:
print("File does not exist: " + p)
- print("Trying another")
if not C:
print("No library file found")
sys.exit(1)