Skip to content

Commit

Permalink
set default unserializable object to be str
Browse files Browse the repository at this point in the history
This prevents date objects from borking the json writing process

As per the last commit, no hats will be consumed on this day.
  • Loading branch information
zkamvar committed Nov 22, 2024
1 parent 1eaae50 commit f9e51fe
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/hub_predtimechart/app/generate_json_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def generate_forecast_json_file(hub_config, model_id_to_df, output_dir, target,
file_name = json_file_name(target, task_ids_tuple, reference_date)
json_file_path = output_dir / file_name
with open(json_file_path, 'w') as fp:
json.dump(forecast_data, fp, indent=4)
json.dump(forecast_data, fp, indent=4, default=str)
return json_file_path

return None
Expand Down

0 comments on commit f9e51fe

Please sign in to comment.