File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed
Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change 5151xldriver : Optional [ModuleType ] = None
5252try :
5353 from . import xldriver
54- except Exception as exc :
54+ except FileNotFoundError as exc :
5555 LOG .warning ("Could not import vxlapi: %s" , exc )
5656
5757WaitForSingleObject : Optional [Callable [[int , int ], int ]]
Original file line number Diff line number Diff line change 88import ctypes
99import logging
1010import platform
11+ from ctypes .util import find_library
1112
1213from . import xlclass
1314from .exceptions import VectorInitializationError , VectorOperationError
1617
1718# Load Windows DLL
1819DLL_NAME = "vxlapi64" if platform .architecture ()[0 ] == "64bit" else "vxlapi"
19- _xlapi_dll = ctypes .windll .LoadLibrary (DLL_NAME )
20-
20+ if dll_path := find_library (DLL_NAME ):
21+ _xlapi_dll = ctypes .windll .LoadLibrary (dll_path )
22+ else :
23+ raise FileNotFoundError (f"Vector XL library not found: { DLL_NAME } " )
2124
2225# ctypes wrapping for API functions
2326xlGetErrorString = _xlapi_dll .xlGetErrorString
You can’t perform that action at this time.
0 commit comments