From a2d91cd56b317f91a96d4b494762fe5e75153258 Mon Sep 17 00:00:00 2001 From: _ <_> Date: Thu, 17 May 2018 12:01:16 -0700 Subject: [PATCH] Handled exception where .so can not be loaded. --- bindings/__init__.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/bindings/__init__.py b/bindings/__init__.py index dbbc6dc..a5d2c47 100644 --- a/bindings/__init__.py +++ b/bindings/__init__.py @@ -1,9 +1,11 @@ -import sys, ctypes +import ctypes sharedlib = './lib3ddevil1.so' -libc = ctypes.cdll.LoadLibrary(sharedlib) -if not libc: +try: + libc = ctypes.cdll.LoadLibrary(sharedlib) +except OSError as e: + print("Error loading dynamically linked library.\nOSError: " + str(e)) raise SystemExit("Couldn't load %s" % sharedlib) # Don't need these anymore -del sys, sharedlib +del sharedlib