You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Im decoding history from a 722 and started to get crashes on decoding the second page. If I turn collate off it decodes just fine. When I turn --collate to get json output I get the following error
File "/usr/lib/python2.7/json/encoder.py", line 177, in default
raise TypeError(repr(o) + " is not JSON serializable")
TypeError: datetime.time(0, 0) is not JSON serializable
I put some prints into the python code - the offending record is below - all records before that parse just fine
---
Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/35254500-wont-decode-page-with-json-collate-typeerror-datetime-time-0-0-is-not-json-serializable?utm_campaign=plugin&utm_content=tracker%2F522759&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F522759&utm_medium=issues&utm_source=github).
The text was updated successfully, but these errors were encountered:
I continue to struggle with errors in decoding datetime in python using mm-decode-history-page.py now and again - Ive solved the problem by adding the following to the code
import datetime
json.JSONEncoder.default = lambda self,obj: (obj.isoformat() if isinstance(obj, datetime.datetime) else None)
now all of the files I had errors with decode to json just fine - Ill try to do a pull request if I remember how :)
Im not sure how openaps traps decoding errors, but I wonder if some of the issues people see with reading history are not bad pump reads (ie comm issues), but rather random decoding errors like this as the python code just crashes with no json output
the offending records - in my experience - generally are changes to basal profiles, carb ratios, etc - not bolus or temp basal history records
Im decoding history from a 722 and started to get crashes on decoding the second page. If I turn collate off it decodes just fine. When I turn --collate to get json output I get the following error
File "/usr/lib/python2.7/json/encoder.py", line 177, in default
raise TypeError(repr(o) + " is not JSON serializable")
TypeError: datetime.time(0, 0) is not JSON serializable
I put some prints into the python code - the offending record is below - all records before that parse just fine
RECORD 18 {'_type': 'ChangeBasalProfile_old_profile', '_description': 'ChangeBasalProfile_old_profile 2016-06-16T18:37:55 head[2], body[145] op[0x08]', 'timestamp': '2016-06-16T18:37:55', '_body': '0030000234000d3a000f2a00122400162400181c001a10001e1c0022260027360000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', '_head': '080b', 'rate': 'offset', '_date': '77a5121010'}
--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/35254500-wont-decode-page-with-json-collate-typeerror-datetime-time-0-0-is-not-json-serializable?utm_campaign=plugin&utm_content=tracker%2F522759&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F522759&utm_medium=issues&utm_source=github).The text was updated successfully, but these errors were encountered: