Spaces:
Sleeping
Sleeping
Improved python code tool
Browse files
agent.py
CHANGED
|
@@ -67,7 +67,7 @@ def run_python_code(code: str):
|
|
| 67 |
# Also allow basic numpy/pandas imports
|
| 68 |
is_safe = is_safe or line.startswith("import numpy") or line.startswith("import pandas")
|
| 69 |
if not is_safe:
|
| 70 |
-
|
| 71 |
|
| 72 |
try:
|
| 73 |
# Capture stdout to get print output
|
|
|
|
| 67 |
# Also allow basic numpy/pandas imports
|
| 68 |
is_safe = is_safe or line.startswith("import numpy") or line.startswith("import pandas")
|
| 69 |
if not is_safe:
|
| 70 |
+
return f"Error: Code contains potentially unsafe import: {line}"
|
| 71 |
|
| 72 |
try:
|
| 73 |
# Capture stdout to get print output
|