qs_ledger
qs_ledger copied to clipboard
apple health: parse error after upgrading to iOS 16
Upgrading to iOS 16 apparently also updated the HealthKit protocol: HealthKit Export Version: 11 to HealthKit Export Version: 12
Parsing export.xml now throughs a parse error:
File "/.../qs_ledger/apple_health/apple-health-data-parser.py", line 118, in __init__
self.data = ElementTree.parse(f)
File "/home/usr/.pyenv/versions/3.10.4/lib/python3.10/xml/etree/ElementTree.py", line 1229, in parse
tree.parse(source, parser)
File "/home/usr/.pyenv/versions/3.10.4/lib/python3.10/xml/etree/ElementTree.py", line 580, in parse
self._root = parser._parse_whole(source)
**xml.etree.ElementTree.ParseError: syntax error: line 156, column 0**
The problem has already been reported and seems to be ignored by Apple: problem with import of XML Apple HealthKit Export Version: 12 Any thoughts on the suggested workaround with "patch.txt"?
While waiting for a fix, I've been opening up the file in a text editor (BBEdit) and deleting the DTD portion of the file (first ~200 lines of the file) and haven't seen any downstream issues since, I believe, nothing is using that metadata.
@aperiodicchain Thanks for pointing this out and posting an issue.
@StevenMMortimer Thanks for sharing a solution. I was able to follow your tip and I was able to run the notebooks by removing all of the lines between <?xml version ?>
and <HealthData ..>
like you see here:
This isn't a real fix but it does provide a workaround for anyone that gets stuck for now. These are admittedly use files to edit.
@markwk I just got the latest iOS:, 16.2. Apple upgraded to
<!-- HealthKit Export Version: 13 -->
and the issue seems to be fixed, at least for me.