Skip to content

armgit / camel

Public Imported from GitHub
0

🐫 CAMEL: The first and the best multi-agent framework. Finding the Scaling Law of Agents. https://www.camel-ai.org

chore: fix terminal_env_init (#3723)

Tao Sun44b10d08842b
diff --git a/camel/toolkits/terminal_toolkit/utils.py b/camel/toolkits/terminal_toolkit/utils.py
index d20b9c67e..499e528f9 100644
--- a/camel/toolkits/terminal_toolkit/utils.py
+++ b/camel/toolkits/terminal_toolkit/utils.py
@@ -384,8 +384,11 @@ def setup_initial_env_with_venv(
symlinks=True,
)
except Exception:
+ # Clean up partial environment
+ if os.path.exists(env_path):
+ shutil.rmtree(env_path)
# Fallback to symlinks=False if symlinks=True fails
- # (e.g., on some Windows configurations)
+ # (e.g., on some Windows configurations or macOS Beta)
venv.create(
env_path,
with_pip=True,
@@ -555,6 +558,9 @@ def clone_current_environment(
try:
venv.create(env_path, with_pip=True, symlinks=True)
except Exception:
+ # Clean up partial environment
+ if os.path.exists(env_path):
+ shutil.rmtree(env_path)
# Fallback to symlinks=False if symlinks=True fails
venv.create(env_path, with_pip=True, symlinks=False)