Skip to content

SWE-agent takes a GitHub issue and tries to automatically fix it, using your LM of choice. It can also be employed for offensive cybersecurity or competitive coding challenges. [NeurIPS 2024]

Fix: Explicitly set log file encoding (#1013)

Kilian Lieret1c534b9f439b
diff --git a/sweagent/utils/log.py b/sweagent/utils/log.py
index 41c9ba15..35b487b6 100644
--- a/sweagent/utils/log.py
+++ b/sweagent/utils/log.py
@@ -110,7 +110,7 @@ def add_file_handler(
The id of the handler. This can be used to remove the handler later.
"""
Path(path).parent.mkdir(parents=True, exist_ok=True)
- handler = logging.FileHandler(path)
+ handler = logging.FileHandler(path, encoding="utf-8")
formatter = logging.Formatter("%(asctime)s - %(levelname)s - %(name)s - %(message)s")
handler.setFormatter(formatter)
handler.setLevel(_interpret_level(level))