Skip to content

Commit 44b10d0

Browse files
fengju0213waleedalzarooniWendong-Fan
authored
chore: fix terminal_env_init (#3723)
Co-authored-by: Waleed Alzarooni <[email protected]> Co-authored-by: Wendong-Fan <[email protected]>
1 parent 2cb50d8 commit 44b10d0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

camel/toolkits/terminal_toolkit/utils.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,8 +384,11 @@ def setup_initial_env_with_venv(
384384
symlinks=True,
385385
)
386386
except Exception:
387+
# Clean up partial environment
388+
if os.path.exists(env_path):
389+
shutil.rmtree(env_path)
387390
# Fallback to symlinks=False if symlinks=True fails
388-
# (e.g., on some Windows configurations)
391+
# (e.g., on some Windows configurations or macOS Beta)
389392
venv.create(
390393
env_path,
391394
with_pip=True,
@@ -555,6 +558,9 @@ def clone_current_environment(
555558
try:
556559
venv.create(env_path, with_pip=True, symlinks=True)
557560
except Exception:
561+
# Clean up partial environment
562+
if os.path.exists(env_path):
563+
shutil.rmtree(env_path)
558564
# Fallback to symlinks=False if symlinks=True fails
559565
venv.create(env_path, with_pip=True, symlinks=False)
560566

0 commit comments

Comments
 (0)