Fix TypeError when writing report sections that contain lists
The `save_report_section_decorator` calls `f.write(content)` but some report sections (e.g. `trader_investment_plan`) can be a list instead of a string, causing `TypeError: write() argument must be str, not list`. Handle this by joining list items with newlines before writing.
This commit is contained in:
parent
f362a160c3
commit
b981c4c2a2
|
|
@ -973,7 +973,10 @@ def run_analysis():
|
|||
if content:
|
||||
file_name = f"{section_name}.md"
|
||||
with open(report_dir / file_name, "w", encoding="utf-8") as f:
|
||||
f.write(content)
|
||||
if isinstance(content, list):
|
||||
f.write("\n".join(str(item) for item in content))
|
||||
else:
|
||||
f.write(content)
|
||||
return wrapper
|
||||
|
||||
message_buffer.add_message = save_message_decorator(message_buffer, "add_message")
|
||||
|
|
|
|||
Loading…
Reference in New Issue