From 54666b111ae4666633f54ecff51521c8a895f533 Mon Sep 17 00:00:00 2001 From: zhulj <1643600218@qq.com> Date: Mon, 27 May 2024 17:34:53 +0800 Subject: [PATCH] fix st game path TypeError --- metagpt/ext/stanford_town/utils/mg_ga_transform.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/metagpt/ext/stanford_town/utils/mg_ga_transform.py b/metagpt/ext/stanford_town/utils/mg_ga_transform.py index e0de76a6b..da1b31a4a 100644 --- a/metagpt/ext/stanford_town/utils/mg_ga_transform.py +++ b/metagpt/ext/stanford_town/utils/mg_ga_transform.py @@ -56,10 +56,16 @@ def get_role_environment(sim_code: str, role_name: str, step: int = 0) -> dict: def write_curr_sim_code(curr_sim_code: dict, temp_storage_path: Optional[Path] = None): - temp_storage_path = Path(temp_storage_path) or TEMP_STORAGE_PATH + if temp_storage_path is None: + temp_storage_path = TEMP_STORAGE_PATH + else: + temp_storage_path = Path(temp_storage_path) write_json_file(temp_storage_path.joinpath("curr_sim_code.json"), curr_sim_code) def write_curr_step(curr_step: dict, temp_storage_path: Optional[Path] = None): - temp_storage_path = Path(temp_storage_path) or TEMP_STORAGE_PATH + if temp_storage_path is None: + temp_storage_path = TEMP_STORAGE_PATH + else: + temp_storage_path = Path(temp_storage_path) write_json_file(temp_storage_path.joinpath("curr_step.json"), curr_step)