diff --git a/autogpts/autogpt/autogpt/plugins/__init__.py b/autogpts/autogpt/autogpt/plugins/__init__.py index 0b08a62e47b3..0bd52fc1aca8 100644 --- a/autogpts/autogpt/autogpt/plugins/__init__.py +++ b/autogpts/autogpt/autogpt/plugins/__init__.py @@ -230,11 +230,12 @@ def scan_plugins(config: Config) -> List[AutoGPTPluginTemplate]: qualified_module_name = ".".join(plugin_module_path) try: - __import__(qualified_module_name) - except ImportError: - logger.error(f"Failed to load {qualified_module_name}") + plugin = importlib.import_module(qualified_module_name) + except ImportError as e: + logger.error( + f"Failed to load {qualified_module_name} from {plugin_path}: {e}" + ) continue - plugin = sys.modules[qualified_module_name] if not plugins_config.is_enabled(plugin_module_name): logger.warning( @@ -261,8 +262,8 @@ def scan_plugins(config: Config) -> List[AutoGPTPluginTemplate]: zipped_package = zipimporter(str(plugin)) try: zipped_module = zipped_package.load_module(str(module.parent)) - except ZipImportError: - logger.error(f"Failed to load {str(module.parent)}") + except ZipImportError as e: + logger.error(f"Failed to load {module.parent} from {plugin}: {e}") continue for key in dir(zipped_module):