Fix module not found error in validate.py

This commit is contained in:
Gabriel Luiz Freitas Almeida 2024-02-25 23:01:23 -03:00
commit 06a68d7ea3

View file

@ -6,7 +6,6 @@ from typing import Dict, List, Optional, Union
from langflow.field_typing.constants import CUSTOM_COMPONENT_SUPPORTED_TYPES
PROMPT_INPUT_TYPES = ["Document", "BaseOutputParser", "Text", "Record"]
@ -204,7 +203,9 @@ def prepare_global_scope(code, module):
for alias in node.names:
exec_globals[alias.name] = getattr(imported_module, alias.name)
except ModuleNotFoundError as e:
raise ModuleNotFoundError(f"Module {node.module} not found. Please install it and try again.") from e
raise ModuleNotFoundError(
f"Module {node.module} not found. Please install it and try again. Error: {repr(e)}"
)
return exec_globals