From 360de0dea55f86c52abd24c5e1e03d9a790f2a8e Mon Sep 17 00:00:00 2001 From: _ <_> Date: Thu, 17 May 2018 14:00:52 -0700 Subject: [PATCH] declared function where del sharedlib is not needed anymore --- bindings/__init__.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/bindings/__init__.py b/bindings/__init__.py index a5d2c47..b49dc36 100644 --- a/bindings/__init__.py +++ b/bindings/__init__.py @@ -1,11 +1,12 @@ import ctypes -sharedlib = './lib3ddevil1.so' -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) +def loadlibc(): + sharedlib = './lib3ddevil1.so' + libc = None + 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 sharedlib +libc = loadlibc() \ No newline at end of file