rbonghi / jetson_stats

📊 Simple package for monitoring and control your NVIDIA Jetson [Orin, Xavier, Nano, TX] series
https://rnext.it/jetson_stats
GNU Affero General Public License v3.0
2.17k stars 264 forks source link

TypeError: Object of type 'timedelta' is not JSON serializable #188

Closed wangxin3924 closed 2 years ago

wangxin3924 commented 2 years ago

jetpack4.6 nx

when run jtop_server.py,

{'time': datetime.datetime(2022, 1, 4, 14, 40, 24, 319422), 'uptime': datetime.timedelta(4, 20268, 820000), 'jetson_clocks': 'ON', 'nvp model': 'MODE_20W_6CORE', 'CPU1': 88, 'CPU2': 71, 'CPU3': 80, 'CPU4': 77, 'CPU5': 71, 'CPU6': 68, 'GPU': 0, 'MTS FG': 3, 'MTS BG': 3, 'RAM': 5074532, 'EMC': 5074532, 'SWAP': 0, 'APE': 150, 'NVENC': 'OFF', 'NVDEC': 'OFF', 'NVJPG': 'OFF', 'fan': 100.0, 'Temp AO': 42.0, 'Temp AUX': 44.5, 'Temp CPU': 46.0, 'Temp GPU': 41.5, 'Temp thermal': 44.2, 'power cur': 8478, 'power avg': 7219}

it's show TypeError: Object of type 'timedelta' is not JSON serializable TypeError: Object of type 'timedelta' is not JSON serializable

what should I do

wangxin3924 commented 2 years ago

I see, json.dumps(jetson.stats, indent=4, sort_keys=True, default=str)