-
Notifications
You must be signed in to change notification settings - Fork 31
Open
Description
The UnicodeDecodeError occurred because the format_json_file function in import_schemas.py was opening JSON files without specifying the encoding. On Windows, Python defaults to the system encoding (cp1252), but the schema files were saved in UTF-8 encoding by the replicate library.
Updated function in import_schemas.py
def format_json_file(file_path):
try:
with open(file_path, "r", encoding="utf-8") as f:
data = json.load(f)
data["run_count"] = 0
with open(file_path, "w", encoding="utf-8") as f:
json.dump(data, f, indent=4, ensure_ascii=False)
except json.JSONDecodeError:
print(f"Error: {file_path} contains invalid JSON")
except IOError:
print(f"Error: Could not read or write to {file_path}")
Metadata
Metadata
Assignees
Labels
No labels