-
Notifications
You must be signed in to change notification settings - Fork 113
Open
Labels
Description
Hi! I'm using pyads on windows I'm interested in being able to specify the location of the ads dll.
Currently, pyads seems to check if the dll is in system directories, the directory of the python executable, and if "$TWINCAT3DIR" is set then "$TWINCAT3DIR/Common64".
Lines 57 to 71 in 54a3418
| # load dynamic ADS library | |
| if platform_is_windows(): # pragma: no cover, skip Windows test | |
| dlldir_handle = None | |
| if sys.version_info >= (3, 8) and "TWINCAT3DIR" in os.environ: | |
| # Starting with version 3.8, CPython does not consider the PATH environment | |
| # variable any more when resolving DLL paths. The following works with the default | |
| # installation of the Beckhoff TwinCAT ADS DLL. | |
| dll_path = os.environ["TWINCAT3DIR"] + "\\.." | |
| if platform.architecture()[0] == "64bit": | |
| dll_path += "\\Common64" | |
| else: | |
| dll_path += "\\Common32" | |
| dlldir_handle = os.add_dll_directory(dll_path) | |
| try: | |
| _adsDLL = ctypes.WinDLL("TcAdsDll.dll") # type: ignore |
For distribution of my app, it is somewhat cumbersome to install the dll in one of these directories and it would be convenient if I could set it to something local.