Is there a way to determine all possible exceptions that might be raised in a code block? (e.g. Some logic that suggests some specific exceptions to catch based on the code block instead of just raising that exception is too generic.
try:
m = check_output(["dd", "--version"]).decode()
ver_line = m.split('\n')[0]
ver = ver_line.split(' ')
if float(ver[2]) >= 8.24:
logger.info("coreutils version: {}, required >= 8.24".format(ver[2]))
else:
logger.warn("coreutils version: {}, required >= 8.24."
"Please ensure that the right version is installed".format(ver[2]))
sys.exit(1)
except Exception:
logger.warn("could not determine coreutils version, required >= 8.24")
return