-
Notifications
You must be signed in to change notification settings - Fork 44
Description
Problem:
TLMC_SDK.try_load_library() currently calls:
cdll.LoadLibrary("./tlmc_xa_native.dll")
This is relative to the current working directory, not a user-specified folder containing the DLL. Scripts run from a different CWD then fail with:
FileNotFoundError: Could not find module '...tlmc_xa_native.dll'
This is strange behaviour as a lab user will typically call in a DLL like this via scripts that could live in a very different directory. The only way to use this function to open the DLL at present is to copy the DLL into the directory containing your Python script, or alternatively use
os.chdir("...path_to_dll_folder...")
inside your script before opening the library to change directory to the DLL folder.
Steps to reproduce:
-
Place tlmc_xa_native.dll in the folder with the Python wrapper.
-
Run a script from a different working directory.
-
Call XASDK.try_load_library(), then see FileNotFoundError.
Suggested Fix:
Use an absolute path to the DLL in the try_load_library
definition inside tlmc_core.py
instead of a relative path. For example:
dll_path = os.path.join(os.path.abspath(dll_folder), "tlmc_xa_native.dll")
TLMC_SDK.xa_lib = cdll.LoadLibrary(dll_path)