Fix backtest summary.txt UnicodeEncodeError on Windows
write_text() defaults to the platform encoding (cp1252 on Windows), which can't encode the arrow character used in the summary header. Force UTF-8 explicitly so backtests complete on Windows hosts. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -694,7 +694,7 @@ def main() -> int:
|
||||
df.to_csv(out_dir / "trades.csv", index=False)
|
||||
|
||||
summary = summarize(df)
|
||||
(out_dir / "summary.txt").write_text(summary)
|
||||
(out_dir / "summary.txt").write_text(summary, encoding="utf-8")
|
||||
|
||||
print("\n" + summary)
|
||||
print(f"\n📁 trades.csv → {out_dir/'trades.csv'}")
|
||||
|
||||
Reference in New Issue
Block a user