Add an informative error when extension requirements are missing

This commit is contained in:
oobabooga 2023-12-19 20:20:45 -08:00
parent d8279dc710
commit 95600073bc
2 changed files with 8 additions and 16 deletions

View file

@ -33,7 +33,12 @@ def load_extensions():
if name != 'api':
logger.info(f'Loading the extension "{name}"...')
try:
exec(f"import extensions.{name}.script")
try:
exec(f"import extensions.{name}.script")
except ModuleNotFoundError:
logger.error(f"Could not import the requirements for '{name}'. Make sure to install the requirements for the extension.\n\nLinux / Mac:\n\npip install -r extensions/{name}/requirements.txt --upgrade\n\nWindows:\n\npip install -r extensions\\{name}\\requirements.txt --upgrade\n\nIf you used the one-click installer, paste the command above in the terminal window opened after launching the cmd script for your OS.")
raise
extension = getattr(extensions, name).script
apply_settings(extension, name)
if extension not in setup_called and hasattr(extension, "setup"):