Skip to content
This repository has been archived by the owner on Apr 14, 2018. It is now read-only.

IndexError: list index out of range #30

Open
benallard opened this issue Jun 24, 2012 · 9 comments
Open

IndexError: list index out of range #30

benallard opened this issue Jun 24, 2012 · 9 comments

Comments

@benallard
Copy link
Contributor

Running fitbit.py:

Start _check_burst_response
received: ['a4', '09', '4f', '00', '3d', '81', '00', '00', '00', '00', '00', '00', '5e']
End _check_burst_response
['0xda', '0xfe', '0xe6', '0x4f', '0xbc', '0x24', '0xd9', '0x00', '0x00', '0x00', '0x33', '0x79', '0x02']
Time: 2012-06-24 13:49:46 Daily Steps: 217
['0x00', '0x00']
Traceback (most recent call last):
  File "./fitbit.py", line 360, in <module>
    sys.exit(main())
  File "./fitbit.py", line 352, in main
    device.parse_bank1_data(device.run_data_bank_opcode(0x01))
  File "./fitbit.py", line 319, in parse_bank1_data
    daily_steps = data[i+7] << 8 | data[i+6]
IndexError: list index out of range
@benallard
Copy link
Contributor Author

Another one, probably related:

Start _check_burst_response
received: ['a4', '09', '4f', '00', '3e', '81', '00', '00', '00', '00', '00', '00', '5d']
End _check_burst_response
['0xf2', '0x91', '0xe8', '0x4f', '0x08', '0x01', '0x05', '0xe8', '0x4f', '0x00', '0xef', '0x91', '0x00']
Time: 2012-06-25 18:29:38
['0x00', '0x00']
Traceback (most recent call last):
  File "./Python/libfitbit/python/fitbit.py", line 360, in <module>
    sys.exit(main())
  File "./Python/libfitbit/python/fitbit.py", line 337, in main
    device.parse_bank2_data(device.run_data_bank_opcode(0x02))
  File "./Python/libfitbit/python/fitbit.py", line 285, in parse_bank2_data
    print "Time: %s" % (datetime.datetime.fromtimestamp(data[i] | data[i + 1] << 8 | data[i + 2] << 16 | data[i + 3] << 24))
IndexError: list index out of range

@benallard
Copy link
Contributor Author

bank1 and bank2 don't have the same format on my device as on yours. I could make the parsing dependant on the firmware version or such, but I need to know which firmware version you have ... Is it documented somewhere ?

@qdot
Copy link
Member

qdot commented Jun 29, 2012

I think it's something like 2.13a?

@benallard
Copy link
Contributor Author

I've got:

Firmware Version: 12
BSL Version: 4.14
APP Version: 4.14

Is that what you're talking about ?

@benallard
Copy link
Contributor Author

Made it dependant on my own (4, 14), see benallard@322fe7b

@benallard benallard reopened this Jul 4, 2012
@benallard
Copy link
Contributor Author

At a closer look, what you called in the code the "firmware version" is called "deviceInfo.hardwareRev" in the fitbit web request. I do think this could be used to distinguish the Fitbit and the FitBit Ultra, beter than the app version or the BSL version ...

What's your's ?

@alfs
Copy link

alfs commented Aug 6, 2012

I get the same error message about list index out of range. I have a fitbit ultra, rev 4.14 (displayed at boot up/reset).

I tried your commit above, and it fixed the problem. Can it be integrated into main, or does it cause problems with fitbit classic?

@benallard
Copy link
Contributor Author

@alfs It just looks like the project maintainer has other priorities.

Actually, about this particular problem, I switched the decision bit from the software version to the hardware revision in a later commit: benallard@6f0248a , as I guess the hardware revision indicates us better if we are talking to a classic or to an ultra tracker.

@qdot
Copy link
Member

qdot commented Aug 12, 2012

Project maintainer has been moving, so yeah, other priorities is about right. (The mozilla-central commits are because I'm paid to do that :) )

I see this commit is in the #34 uber pull request. Unfortunately I wasn't paying attention and merged things backward (this is why I usually never use pull request merge buttons), so I'll need to fix up the patch to merge it. Might also take me a bit to code review 'cause there's kind of a lot going on there. I'll try to get to it soon though.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants