ifitsync icon indicating copy to clipboard operation
ifitsync copied to clipboard

IndexError: list index out of range

Open fitig opened this issue 2 years ago • 4 comments

I get this error when uploading a workout. I believe this is a workout that was captured in the ifit app on a phone rather than from a treadmill itself. Here is the actual error output:

Uploaded Body Weight HIIT Workout Calorie data successfully Traceback (most recent call last): File "ifitsync/ifitsync.py", line 691, in UploadIfitDistanceToGoogle(y) File "ifitsync/ifitsync.py", line 314, in UploadIfitDistanceToGoogle + IfitWorkoutJson.lists["meters"][0]["offset"] * 1000000, IndexError: list index out of range

I'm having a hard time figuring out which value Google isn't liking. Do you mind pointing me in the right direction?

fitig avatar Jun 07 '22 23:06 fitig

The function that is erroring out is the portion that uploads the distance that you ran at intervals. I'm guessing that maybe this workout didn't create a list for this metric? I can't say for sure without seeing the json that the script is retrieving.

omriasta avatar Jun 07 '22 23:06 omriasta

One suggestion to bypass this error would be to comment out line 691 which will let the script continue without uploading this metric. If the issue is only this metric, the script should complete successfully and won't try to reupload this workout. If it continues to fail, you can comment out the functions that error until you get it to complete.

omriasta avatar Jun 07 '22 23:06 omriasta

<shamelessly stealing from the code you provided in issue 8> Here is the history.json and stats.json. Does anything stick out?

stats_and_history_json.zip

fitig avatar Jun 07 '22 23:06 fitig

Yep, if you look at the stats as well as the totals in those files, the only thing that ifit is storing is calories. It has distance, HR, speed etc all at 0. If you look at the stats, it should have a list like calories does for all the other metrics....

omriasta avatar Jun 08 '22 00:06 omriasta