Skip to content

Commit 9fbaec3

Browse files
Merge pull request #2798 from blacklanternsecurity/more-helpful-error
More helpful error message when failing to load BBOT module
2 parents 9e32196 + c7bbfe7 commit 9fbaec3

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

bbot/core/helpers/depsinstaller/installer.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from ansible_runner.interface import run
1717
from subprocess import CalledProcessError
1818

19+
from bbot import __version__
1920
from ..misc import can_sudo_without_password, os_platform, rm_at_exit, get_python_constraints
2021

2122
log = logging.getLogger("bbot.core.helpers.depsinstaller")
@@ -174,6 +175,7 @@ async def install(self, *modules):
174175
+ self.venv
175176
+ str(self.parent_helper.bbot_home)
176177
+ os.uname()[1]
178+
+ str(__version__)
177179
).hexdigest()
178180
success = self.setup_status.get(module_hash, None)
179181
dependencies = list(chain(*preloaded["deps"].values()))

bbot/core/modules.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,12 @@ def preload_module(self, module_file):
460460
def load_modules(self, module_names):
461461
modules = {}
462462
for module_name in module_names:
463-
module = self.load_module(module_name)
463+
try:
464+
module = self.load_module(module_name)
465+
except ModuleNotFoundError as e:
466+
raise BBOTError(
467+
f"Error loading module {module_name}: {e}. You may have leftover artifacts from an older version of BBOT. Try deleting/renaming your '~/.bbot' directory."
468+
) from e
464469
modules[module_name] = module
465470
return modules
466471

0 commit comments

Comments
 (0)