python-microscope / microscope

Python library for control of microscope devices, supporting hardware triggers and distribution of devices over the network for performance and flexibility.
https://www.python-microscope.org
GNU General Public License v3.0
66 stars 39 forks source link

linkaminitialiseSDK returns a True value even if it fails #213

Closed iandobbie closed 3 years ago

iandobbie commented 3 years ago

The current linkham initialisation code fails. There is constructed search path for the license file. The code is included below, but the first call fails, but returns a value that maps to True so the rest of the search path is never traversed.

   lpaths = [
        os.path.dirname(microscope.abc.__file__),
        os.path.dirname(__file__),
        "",
    ]
    for p in lpaths:
        lskpath = os.path.join(p, "Linkam.lsk")
        if _lib.linkamInitialiseSDK(sdk_log, lskpath.encode(), True):
            break
    else:
        raise microscope.LibraryLoadError(
            "No linkam license file (Linkam.lsk) found in %s." % lpaths
        )
iandobbie commented 3 years ago

fixed in #214