From 0cf7d93a914427ffd0c44edddb35e83cd50dd07b Mon Sep 17 00:00:00 2001 From: Jieyu Zhang Date: Fri, 14 Jul 2023 11:55:49 -0700 Subject: [PATCH] modify the python filename extraction modify from `code[11 : code.find("\n")].strip()` to `code[11 : code.find(".py")].strip() + '.py'` otherwise, invalid python file name would cause issue in committing current docker --- flaml/autogen/agent/user_proxy_agent.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flaml/autogen/agent/user_proxy_agent.py b/flaml/autogen/agent/user_proxy_agent.py index 210bb698e7..dd68c3fec9 100644 --- a/flaml/autogen/agent/user_proxy_agent.py +++ b/flaml/autogen/agent/user_proxy_agent.py @@ -91,7 +91,7 @@ def _execute_code(self, code_blocks): logs = logs.decode("utf-8") elif lang in ["python", "Python"]: if code.startswith("# filename: "): - filename = code[11 : code.find("\n")].strip() + filename = code[11 : code.find(".py")].strip() + '.py' else: filename = None exitcode, logs, image = execute_code(