Skip to content

Commit f06f283

Browse files
authored
Add library version detection (#4)
This will let us handle future changes in library functionality more gracefully by informing the user of the need to update their low-level library rather than raising AttributeError.
2 parents d60837b + bca2f2c commit f06f283

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

absscpi/client.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,12 @@ def __init__(self, lib: str = LIB_NAME):
181181
f"The SCPI library could not be loaded ({lib_path})"
182182
) from None
183183

184+
# assume we're at version 1.0.0 unless we can load the version function
185+
# and find out otherwise (this function is new in 1.1.0)
186+
self.__lib_version = 1_00_00
187+
if hasattr(self.__dll, "AbsScpiClient_Version"):
188+
self.__lib_version = self.__dll.AbsScpiClient_Version()
189+
184190
def __enter__(self):
185191
self.init()
186192
return self

0 commit comments

Comments
 (0)