Skip to content

Commit

Permalink
Add authorized_imports in importFrom errors (#506)
Browse files Browse the repository at this point in the history
  • Loading branch information
CalOmnie authored Feb 9, 2025
1 parent 881ce13 commit 01c5106
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/smolagents/local_python_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1067,7 +1067,9 @@ def check_module_authorized(module_name):
else:
raise InterpreterError(f"Module {expression.module} has no attribute {alias.name}")
else:
raise InterpreterError(f"Import from {expression.module} is not allowed.")
raise InterpreterError(
f"Import from {expression.module} is not allowed. Authorized imports are: {str(authorized_imports)}"
)
return None


Expand Down

0 comments on commit 01c5106

Please sign in to comment.