From 2dba7a6920735a6a39b229cd58d091466d4654ad Mon Sep 17 00:00:00 2001 From: Andrew Hamilton Date: Thu, 9 Dec 2021 17:37:13 +1000 Subject: [PATCH] tools: Fix error in is_tool_available. - Happened with bandit, but not pycodestyle. Not sure why. --- eris/eris/tools.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/eris/eris/tools.py b/eris/eris/tools.py index dd1f128..2d3b2a4 100755 --- a/eris/eris/tools.py +++ b/eris/eris/tools.py @@ -657,7 +657,10 @@ def splitext(path): @functools.lru_cache() def is_tool_available(tool): if (hasattr(tool, "command") and tool.command.startswith(f"{PYTHON_EXECUTABLE} -m ")): - return importlib.util.find_spec(tool.command.split()[2]) is not None + try: + return importlib.util.find_spec(tool.command.split()[2]) is not None + except ModuleNotFoundError: + return False try: return all(shutil.which(executable) for executable in tool.executables) except AttributeError: