Pytrainer in Ubuntu 8.10, Ibex Intrepid

I just use the Gutsy binary, which works fine in Ibex.

echo "deb http://www.e-oss.net/ubuntu/gutsy/ ./" | sudo tee -a /etc/apt/sources.list
sudo apt-get update
sudo apt-get install pytrainer
sudo apt-get install python-gnome2-extras

To get the Garmin kernel driver working in user space, make an udev rule in /etc/udev/rules.d/51-garmin.rules with this content

SYSFS{idVendor}=="091e", SYSFS{idProduct}=="0003", MODE="666"

Pytrainer is made to use path like /dev/ttyUSBX to connect to the Garmin watch. I believe the right way is to use Garmin usb driver directly, hence usb: in the config. Therefore you have to open /usr/share/pytrainer/plugins/garmin-hr/main.py and change

if not os.path.exists(options.device):

to

if (not os.path.exists(options.device) and not options.device == "usb:"):

In Tools -> GPS Device Plugins -> Garmin* ->Preferences change device to [usb:] and status to [Enable].

Thats it, have fun :)

Updated: 11 January 2009:
– Quotes in code-blocks is now “copy/paste enabled”
– Pauls comment from December 31st, 2008 at 14:22 added to the text

36 tanker om "Pytrainer in Ubuntu 8.10, Ibex Intrepid"

  1. Hi

    I still don’t get it to work… In the terminal it says

    clicked

    /usr/share/pytrainer//plugins/garmin-hr
    /usr/share/pytrainer//plugins/garmin-hr/main.py –device usb

    and then it pops up a allert message box

    Cant open garmin device. Check your configuration or connect the device correctly.

    Do you have any ideas?

    Br, Lars

  2. I also have problems with Intrepid

    I have followed the description and ends up with this error in a messagebox:
    “Cannot open Garmin device. Check your configuration or connect the device correctly.”

    If I look in /dev/ in Intrepid, I can not find ttyUSB0. I think that might causing the problem?

  3. Do you use “usb:” as device, or /dev/ttyUSB0?

    I use usb: and the above hack, because I believe it is the right way. If you use /dev/ttyUSB0, then it won’t work, if you insert for instance a USB2Serial port before the Garmin watch.

  4. I have copied the line:
    if (not os.path.exists(options.device) and not options.device == “usb:”):
    Just as above into main.py

    The problem is, that the “options.device” part in the expression returns ttyUSB0

    Im not sure, where that comes from?

  5. Now i get:
    /usr/lib/python2.5/site-packages/pytz/__init__.py:29: UserWarning: Module dateutil was already imported from /var/lib/python-support/python2.5/dateutil/__init__.py, but /var/lib/python-support/python2.5 is being added to sys.path
    from pkg_resources import resource_stream
    location: /usr/lib/xulrunner-1.9.0.3/libxpcom.so
    before 3
    this function is obsolete, use getValue instead
    this function is obsolete, use getValue instead
    this function is obsolete, use getValue instead
    this function is obsolete, use getValue instead
    this function is obsolete, use getValue instead
    this function is obsolete, use getValue instead
    this function is obsolete, use getValue instead
    Loading Plugin Google Earth
    Loading Plugin Garmin Heart Rate
    Loading Extension Pytrainer wordpress extension

    When i start pytrainer

    When i try to import i get this in the terminal:
    /usr/share/pytrainer//plugins/garmin-hr/main.py –device usb:
    usb_set_configuration failed, probably because kernel driver ”
    is blocking our access to the USB device.
    For more information see http://www.gpsbabel.org/os/Linux_Hotplug.html
    Traceback (most recent call last):
    File “/usr/share/pytrainer//plugins/garmin-hr/main.py”, line 43, in
    gtrnctr2gpx(“/tmp/file.gtrnctr”,”/tmp/file.gpx”)
    File “/usr/share/pytrainer/plugins/garmin-hr/gtrnctr2gpx.py”, line 29, in gtrnctr2gpx
    dom = xml.dom.minidom.parse(gtrnctrfile)
    File “/usr/lib/python2.5/xml/dom/minidom.py”, line 1915, in parse
    return expatbuilder.parse(file)
    File “/usr/lib/python2.5/xml/dom/expatbuilder.py”, line 922, in parse
    fp = open(file, ‘rb’)
    IOError: [Errno 2] No such file or directory: ‘/tmp/file.gtrnctr’
    Traceback (most recent call last):
    File “/usr/lib/python2.5/site-packages/pytrainer/main.py”, line 114, in runPlugin
    self.record.editRecord(gpxfile,list_sport)
    File “/usr/lib/python2.5/site-packages/pytrainer/record.py”, line 65, in editRecord
    gpxfile = self.conf.getValue(“gpxdir”)+”/%d.gpx”%int(id_record)
    ValueError: invalid literal for int() with base 10: ”

    Not good! :)

  6. I don’t think the warning is a problem, but:

    /usr/share/pytrainer//plugins/garmin-hr/main.py –device usb:
    usb_set_configuration failed, probably because kernel driver ”
    is blocking our access to the USB device.

    was solved here by the Udev rule. Have you made that? Maybe restarted udev afterwards.

  7. Yes – i have.

    One thing though is, that i discovered a problem with copying the double qutes from this page. They are different start and end quotes, so they have to be manually changed to “code-doublequtes”.
    Yesterday it gave me an error in main.py – i had no problems finding that. But now, when you asked me about the rule, i discovered that the problem also existed here. :)
    So after changing the quotes and a reboot – it all works fine under 8.10.

    Thank you again!

    Now i just need to get my Sonofon wireless to function – then i am a free running mann. :)

  8. Great, and no problem. And yes, the doubleqoute is really annyoing :)

    If I had the time, I would like to make a C/C++ version of Pytrainer, or just learn Python and make some new feature and better graphs… But don’t have the time :)

  9. I really like pytrainer to, i have looked into the python code with great interest. I also would like to make more/better graphs – i hope to find the time someday. :)
    Now most of my EEE trouble is over, that must give some extra time – actually a lot:)

    I have seen somwhere, that it should be possible to start pytrainer wit a special parameter, to view google Maps directly in the program. Have you heard/read about that?

  10. I Just must say thanks now my Pytrainer works like a charm! What should I do with out you :)

    Br,

    Lars

  11. Perfect!
    Ubuntu 8.10
    installed PyTrainer and python-gnome-extras as suggested
    left garmin_gps blacklisted
    made the code-change [and not options.device == “usb:”):]
    added 51-garmin.rules with SYSFS{idVendor}==”091e”, SYSFS{idProduct}==”0003?, MODE=”666? (as opposed to other suggestions out there)
    restarted
    corrected the pasted quotes snafu & restarted again ;-)
    Works like a charm. Many, many thanks.

  12. important addendum: Stated above, but not spelled out for dummies (so it took me a second go around to get it!)
    In Tools -> GPS Device Plugins -> Garmin* ->Preferences
    Change device to [usb:] and status to [Enable]
    Thanks, all. Really pleased.

  13. Careful attention to double-quotes on cut-n-paste and it is now working for me, too. You are the man!

  14. Just wanted to say thank you. Your example and the discussion on this page helped me get this working. This will REALLY be nice for tracking our workouts. Thanks again!

  15. That’s all really great.
    Thank you very much!
    With your advices I’ve got it working on my Ubuntu 8.04 notebook.

  16. I have just found out, that my gpsbabel fails to use the garmin_gps driver. I guess because of the latest update, does anyone else has this problem?

    I am running Ubuntu 8.10 with the latest updates.

  17. er sq lidt på spanden her …. total rookie… synes jeg har prøbet alt men pytrainer kan stadig ikke se min garmin forrunner 305 …. kan jeg få lidt hjælp.

  18. og hvad mere mærkeligt er …efter jeg har genstartet , er pytrainer bare helt “hvid” i alle felterne …

  19. Hej
    Jeg har også Pytrainer problemer. Helt hvid uden indhold
    (kan ses her: http://www.vbg6.dk/pytrainer.jpg)
    Pytrainer holdt op med at virke efter jeg forsøgte at tilslutte min Garmin 305. Jeg har rodet rundt på forskellige hjemmesider og lavet tilrettelser til
    /usr/share/pytrainer/plugins/garmin-hr/main.py
    /etc/udev/rules.d/51-garmin.rules
    osv
    Removed pytrainer, geninstalleret, rebooted osv – uden held. Når jeg starter pytrainer i terminal viser den:

    jan@jan-ubuntu:~$ pytrainer
    location: /usr/lib/xulrunner-1.9.0.6/libxpcom.so
    before 3
    this function is obsolete, use getValue instead
    this function is obsolete, use getValue instead
    this function is obsolete, use getValue instead
    this function is obsolete, use getValue instead
    this function is obsolete, use getValue instead
    this function is obsolete, use getValue instead
    this function is obsolete, use getValue instead
    Loading Plugin Garmin
    Ingen aktive udvidelser
    Traceback (most recent call last):
    File “/usr/lib/python2.5/site-packages/pytrainer/gui/windowmain.py”, line 499, in on_page_change
    self.parent.refreshGraphView(self.selected_view)
    File “/usr/lib/python2.5/site-packages/pytrainer/main.py”, line 139, in refreshGraphView
    self.windowmain.actualize_dayview(record_list)
    File “/usr/lib/python2.5/site-packages/pytrainer/gui/windowmain.py”, line 187, in actualize_dayview
    average = distance/(timeinseconds/60/60)
    ZeroDivisionError: float division
    Traceback (most recent call last):
    File “/usr/bin/pytr”, line 44, in
    main()
    File “/usr/bin/pytr”, line 41, in main
    pytrainer = pyTrainer(None, data_path)
    File “/usr/lib/python2.5/site-packages/pytrainer/main.py”, line 78, in __init__
    self.windowmain.on_calendar_selected(None)
    File “/usr/lib/python2.5/site-packages/pytrainer/gui/windowmain.py”, line 537, in on_calendar_selected
    self.parent.refreshGraphView(self.selected_view)
    File “/usr/lib/python2.5/site-packages/pytrainer/main.py”, line 139, in refreshGraphView
    self.windowmain.actualize_dayview(record_list)
    File “/usr/lib/python2.5/site-packages/pytrainer/gui/windowmain.py”, line 187, in actualize_dayview
    average = distance/(timeinseconds/60/60)
    ZeroDivisionError: float division

    ————————-
    altså den ender med “ZeroDivisionError”

  20. Prøv at tage en kopi af ~/.pytrainer, fjern den og start programmet igen. Dur det?

    Hvilke version af Ubuntu køre du?
    Er pytrainer installeret som beskrevet her?

    /Christoffer

  21. Tak for det! Nu kan pytrainer starte! Og jeg kan importere en gpx-fil, som jeg har udtrukket med
    gpsbabel -t -r -w -i garmin -f usb: -o gpx -F outputfile.gpx

    Pytrainer viser nu “import from garmin”, men der sker ikke noget, når jeg trykker.
    1.000 tak for hjælpen!

  22. Hej igen.

    Jeg har netop fået ny computer. I den forbindelse, vil jeg naturligvis have pytrainer installeret.
    Men da jeg forsøger at hente programmet med (sudo apt-get install pytrainer), får jeg en meddelelse om, at det ikke eksisterer mere.
    Jeg har udført kommandoerne øverst her på siden – altså tilføjet gutsy til sources.list o.s.v.

    Jeg mener også at have set, at Ubuntu ikke længere supporterer Gutsy?

    Har du en ide om hvad man kan gøre?

  23. Jeg har ikke lige kunne finde den nyeste deb pakke, men:

    sudo apt-get install gpsbabel python-excelerator dvipng python-tz python-matplotlib-data python-soappy python-dateutil python-pyparsing python-fpconst python-matplotlib python-scipy xulrunner
    wget http://ovh.dl.sourceforge.net/sourceforge/pytrainer/pytrainer-1.6.0.7.tar.gz
    tar -zxvf pytrainer-1.6.0.7.tar.gz
    cd pytrainer-1.6.0.7
    sudo ./pytrainer.sh

    Du skal så nok lige ligge det et andet sted, og selv lave et link til den. Husk desuden at tage backup af ~/.pytrainer!

    Derudover overvejer jeg stadig MEGET kraftigt at lave min egen version i C++, men har stadig ikke tiden :)

  24. Jeg har kørt tingene igennem som beskrevet og enabled Garmin Heartrate monitor (usb:)

    Jeg kan ikke køre kommandoen ./pytrainer.sh med sudo. Uden går det dog fint.

    Den skriver dog følgende i konsollen, men det er vist harmløst?

    location: /usr/lib/xulrunner-1.9.0.8/libxpcom.so
    before 3
    *** Log level set to ERROR ***
    this function is obsolete, use getValue instead
    Ingen aktive udvidelser

    Når jeg vælger import, kommer der et lille vindue frem “Fremgang”. og pytrainer tones ned. Efter et stykke tid udfyldes “fremgangsbaren” og man kan klikke på Ok-knappen. Når jeg gør det sker der ikke yderligere?

    Men der kommer aldrig data frem, heller ikke når jeg lukker det lille vindue?

    Der kommer heller ikke nogen advarsler eller andet i konsolvinduet?

  25. Pingback: Pytrainer in Ubuntu 9.10, Karmic Koala @ Christoffer Kjølbæk

Skriv et svar

Din e-mail-adresse vil ikke blive offentliggjort. Krævede felter er markeret med *

Disse HTML koder og attributter er tilladte: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>