Skip to content

lecture01 generate json #19

Description

@J6une21
error as follow:

Traceback (most recent call last):
File "D:\LLM\cs336\spring2025-lectures\execute.py", line 264, in
trace = execute(module_name=module, inspect_all_variables=args.inspect_all_variables)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\LLM\cs336\spring2025-lectures\execute.py", line 241, in execute
module.main()
File "D:\LLM\cs336\spring2025-lectures\lecture_01.py", line 30, in main
course_components()
File "D:\LLM\cs336\spring2025-lectures\lecture_01.py", line 221, in course_components
data()
File "D:\LLM\cs336\spring2025-lectures\lecture_01.py", line 362, in data
look_at_web_data()
File "D:\LLM\cs336\spring2025-lectures\lecture_01.py", line 387, in look_at_web_data
write_documents(documents, "var/sample-documents.txt")
File "D:\LLM\cs336\spring2025-lectures\data.py", line 54, in write_documents
print(document.content, file=out)
UnicodeEncodeError: 'gbk' codec can't encode character '\xbb' in position 3551: illegal multibyte sequence

l try adding utf-8,but not solve this problem.

with open(output_path, "w", encoding="utf-8") as f:
json.dump(asdict(trace), f, indent=2)
So what should I do?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions