TODAM-tw / todam-ticket-system

The frontend with gradio and combined with the API endpoints for the ticket system.
Apache License 2.0
0 stars 0 forks source link

[Bug] TypeError: 'NoneType' object is not callable #18

Closed 1chooo closed 1 month ago

1chooo commented 1 month ago

https://github.com/TODAM-tw/todam-ticket-system/blob/7e6abfd17bcadfffbe36aad53846b5b20f41e98c/app/cases/segment.py#L36

這樣會導致

print(str(segment_id_name_map))
          ^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'NoneType' object is not callable

可以用 json.dumps() 的方式轉換 JSON type 的 str

segment_id_name_map = {segment["segment_id"]: segment["segment_name"] for segment in data["segments"]}

segment_id_name_map_str = json.dumps(segment_id_name_map, ensure_ascii=False, indent=4)
1chooo commented 1 month ago

需要研究為什麼不能直接用 str() 來轉換