Error: list index out of range

Bug #135717 reported by whamblen
2
Affects Status Importance Assigned to Milestone
garmin-sync
Fix Released
Undecided
Björn Tillenius

Bug Description

Hi,

I just tried GarminSync 0.20 with a Forerunner 305 on a fully patched Ubuntu 7.04 system with pyusb-0.4.0 installed by hand. This is what the error looked like.

whamblen@wake:~/garmin-sync-0.2$ sudo ./garminsync.py
Password:
Getting data from GPS (this might take a while)...
Traceback (most recent call last):
  File "./garminsync.py", line 367, in <module>
    exit_value = garmin_sync.run()
  File "./garminsync.py", line 361, in run
    gps.export_activities('exports')
  File "./garminsync.py", line 342, in export_activities
    for activity in self.get_activities():
  File "./garminsync.py", line 318, in get_activities
    laps = dict((lap.index, lap) for [lap] in self.getLaps())
  File "/home/whamblen/garmin-sync-0.2/garmin.py", line 1770, in getLaps
    return self.lapLink.getData(callback)
  File "/home/whamblen/garmin-sync-0.2/garmin.py", line 455, in getData
    self.link.Pid_Lap)
  File "/home/whamblen/garmin-sync-0.2/garmin.py", line 312, in getData
    p = self.datatypes[index]()
IndexError: list index out of range

I also tried with a friend's Forerunner 205. Both have 10-12 runs stored. The 305 has some runs with HR data but most without. Let me know if I can do anything to help figure it out. I love the idea of being able to use Garmin sync. Thank you for the efforts so far!

Revision history for this message
Björn Tillenius (bjornt) wrote :

I won't be able to look at this closer before next week, but does this error happen every time you try to run it? Sometimes I get errors, which go away if I unplug and replug the USB cable.

BTW, I see that you use sudo to run garminsync.py. At http://www.gpsbabel.org/os/Linux_Hotplug.html there are instructions how to set up the permissions for the USB device, so you don't have to use sudo.

Changed in garmin-sync:
status: New → Incomplete
Revision history for this message
whamblen (whamblen) wrote : Re: [Bug 135717] Re: Error: list index out of range

Hi Björn,

On 8/29/07, Björn Tillenius <email address hidden> wrote:
>
> I won't be able to look at this closer before next week,

Whenever you have time is fine with me. If I figure anything
out myself I will follow up to the bug report.

but does this
> error happen every time you try to run it? Sometimes I get errors, which
> go away if I unplug and replug the USB cable.

No, a couple times I got a different error relating to it not seeing the
device but that goes away when I replug it. :-) But I haven't ever
successfully downloaded data.

> BTW, I see that you use sudo to run garminsync.py. At
> http://www.gpsbabel.org/os/Linux_Hotplug.html there are instructions how
> to set up the permissions for the USB device, so you don't have to use
> sudo.

Thanks, I actually do have that setup correctly; I can get the same error
without sudo. I can also use gpsbabel without sudo. I think that was a cut
and paste from one of my earliest attempts when I tried as root to see if it
made any difference.

 - Bill

Revision history for this message
Björn Tillenius (bjornt) wrote :

On Thu, Aug 30, 2007 at 11:33:12AM -0000, whamblen wrote:
> but does this
> > error happen every time you try to run it? Sometimes I get errors, which
> > go away if I unplug and replug the USB cable.
>
>
> No, a couple times I got a different error relating to it not seeing the
> device but that goes away when I replug it. :-) But I haven't ever
> successfully downloaded data.

OK, that sounds like something I haven't encountered before, I'll take a
look at it later. I'll probably have to add some debug statements in the
code to know what's going on.

Changed in garmin-sync:
assignee: nobody → bjornt
status: Incomplete → Confirmed
Revision history for this message
whamblen (whamblen) wrote :

I was messing around with this a little bit more last night and may have some more information. I don't really understand the code, but it looks to me like that index is out of range because the datapoint class (D1015?) associated with the lap class (A906) hasn't ever been defined but one is required. I'm guessing maybe your Edge uses a different datapoint class than my Forerunner. For sure self.datatypes = [] when the A906 getData call is made.

Here is the list of protocols returned by my forerunner.

whamblen@wake:~/garmin-sync-0.2$ ./garminsync.py
Get supported protocols
Try reading protocols using PCP
Got msg type 248, retrying...
Protocols reported by A001: ['P000', 'L001', 'A010', 'T001', 'A100', 'D110', 'A201', 'D202', 'D110', 'D210', 'A302', 'D311', 'D304', 'A500', 'D501', 'A600', 'D600', 'A601', 'D601', 'A700', 'D700', 'A800', 'D800', 'A801', 'D801', 'A902', 'A903', 'A907', 'D907', 'D908', 'D909', 'D910', 'A918', 'D918', 'A1000', 'D1009', 'A906', 'D1015', 'A1002', 'D1008', 'A1003', 'D1003', 'A1004', 'D1004', 'A1005', 'D1005', 'A1006', 'D1006', 'A1007', 'D1007', 'A1008', 'D1012', 'A1009', 'D1013', 'A1013', 'D1014']

D1015 immediately follows A906 and that appears (to me anyway) to mean that I need to create a class for it. Unfortunately I couldn't find any documentation from Garmin for that class. Somebody submitted a patch to gpsbabel that will download laps from my Forerunner (and only laps as I recall). Could the necessary info be gleaned from that? http://www.nabble.com/Re:-Lap:-How-to-get-from-a-device--t4014195.html

Anyway, I hope I'm not bothering you with all this. But I didn't want to keep potentially useful information hidden away either. :-)

 - Bill

Revision history for this message
whamblen (whamblen) wrote :

Hi Björn,

I just submitted an addendum to this bug and immediately afterwards had an
epiphany. D1011 is the only lap type defined in the garmin.py you
distribute so I guessed that is what your Edge uses. Furthermore it looked
to have the right fields for my Forerunner. So I made a copy of the D1011
class and named it D1015. The code runs to completion now!

I've got to get to work but I'll follow up tonight or tomorrow and let you
know if the tcx files seem correct. I don't see why they won't be but I
don't have a handy way to view them in Linux.

 - Bill

On 8/30/07, Björn Tillenius <email address hidden> wrote:
>
> On Thu, Aug 30, 2007 at 11:33:12AM -0000, whamblen wrote:
> > but does this
> > > error happen every time you try to run it? Sometimes I get errors,
> which
> > > go away if I unplug and replug the USB cable.
> >
> >
> > No, a couple times I got a different error relating to it not seeing the
> > device but that goes away when I replug it. :-) But I haven't ever
> > successfully downloaded data.
>
> OK, that sounds like something I haven't encountered before, I'll take a
> look at it later. I'll probably have to add some debug statements in the
> code to know what's going on.
>
> ** Changed in: garmin-sync
> Assignee: (unassigned) => Björn Tillenius
> Status: Incomplete => Confirmed
>
> --
> Error: list index out of range
> https://bugs.launchpad.net/bugs/135717
> You received this bug notification because you are a direct subscriber
> of the bug.
>

Revision history for this message
Björn Tillenius (bjornt) wrote :

Thanks for your report. I've released 0.3, which includes D1015.

Changed in garmin-sync:
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.