Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def check_nix_version():
if not HAVE_NIX:
raise Exception(
"Failed to import NIX. "
"The NixIO requires the Python package for NIX "
"(nixio on PyPi). Try `pip install nixio`."
)
# nixio version numbers have a 'v' prefix which breaks the comparison
nixverstr = nix.__version__.lstrip("v")
try:
nixver = Version(nixverstr)
except ValueError:
warnings.warn(
"Could not understand NIX Python version {}. "
"The NixIO requires version {} of the Python package for NIX. "
"The IO may not work correctly.".format(nixverstr,
str(MIN_NIX_VER))
)
return
if nixver < MIN_NIX_VER:
raise Exception(
"NIX version not supported. "
"The NixIO requires version {} or higher of the Python package "
"for NIX. Found version {}".format(str(MIN_NIX_VER), nixverstr)