Christoffer Kjølbæk I have a blog, therefore I am…

3May/0849

Pytrainer in Ubuntu 8.04 Hardy Heron

Pytrainer didn’t work for me under Ubuntu 8.04, because my Garmin Forerunner wasn’t attached to /dev/ttyUSBx something which Pytrainer assumes.

To use gpsbabel and Garmin Forerunner, a command like the one below is used

gpsbabel -t -i garmin -f usb: -o gtrnctr -F /tmp/file.gtrnctr

“usb:” is the input device. The problem is that Pytrainer checks if the device exists as a file/directory, which it doesn’t. The workaround is to open /usr/share/pytrainer/plugins/garmin-hr/main.py and change

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

into

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

Updated 04-05-08 12:41:
Philippe Piquer just pointed out that the reason it don't work in Ubuntu 8.04, is that the garmin_gps module has been blacklisted. According to /etc/modprobe.d/blacklist because

# most apps now use garmin usb driver directly (Ubuntu: #114565)

Updated 04-05-08 21:21:
There must be a file /etc/udev/rules.d/51-garmin.rules containing

SYSFS{idVendor}=="091e", SYSFS{idProduct}=="0003", GROUP="plugdev", MODE="660"

Kommentarer (49) Trackbacks (1)
  1. Hi Christoffer

    I tested Pytrainer on 7.10 but my update to 8.04 malfunction and I needed to install the OS all over again… So now I would like to reinstall Pytrainer but the dowload site on the Homepage for Pytrainer only describe the way to install on Gutsy and the older versions. Could you help me (a how-to ?) with how I should do… I’m still quite a newbie so please describe each detail, why not put it on the blog or the Ubuntu forum…

    Br,

  2. Hi Lars

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

    So you just add “deb http://www.e-oss.net/ubuntu/gutsy/ ./” to the end of /etc/apt/sources.list and then:
    sudo apt-get update && sudo apt-get install pytrainer

    That worked for me, let me know if it doesn’t work for you.

    Best regards
    Christoffer

  3. Get this answer after running pytrainer …

    :> pytrainer
    Traceback (most recent call last):
    File “/usr/bin/pytr”, line 38, in
    from pytrainer.main import pyTrainer
    File “/usr/lib/python2.5/site-packages/pytrainer/main.py”, line 38, in
    from extensions.googlemaps import Googlemaps
    File “/usr/lib/python2.5/site-packages/pytrainer/extens

    Br,

  4. Missed the end send it ones more…

    :> pytrainer
    Traceback (most recent call last):
    File “/usr/bin/pytr”, line 38, in
    from pytrainer.main import pyTrainer
    File “/usr/lib/python2.5/site-packages/pytrainer/main.py”, line 38, in
    from extensions.googlemaps import Googlemaps
    File “/usr/lib/python2.5/site-packages/pytrainer/extensions/googlemaps.py”, line 19, in
    import gtkmozembed
    ImportError: No module named gtkmozembed

    Br,

  5. Ahh, you need the package libgecko2.0-cli:
    sudo apt-get install libgecko2.0-cil

  6. And you might need to check /usr/bin/pytrainer, and make sure it looks like

    #/bin/sh
    LD_LIBRARY_PATH=/usr/lib/firefox MOZILLA_FIVE_HOME=/usr/lib/firefox python /usr/bin/pytr

    And the libgecko2.0-cli might not be need… Can’t really remember, but used quite a lot of time to get it work…

  7. Well I got the same failure…Still

  8. Hmm, could you try “strace -o strace.log /usr/bin/pytr” and mail me the log?

  9. strace -o strace.log /usr/bin/pytr
    Traceback (most recent call last):
    File “/usr/bin/pytr”, line 38, in
    from pytrainer.main import pyTrainer
    File “/usr/lib/python2.5/site-packages/pytrainer/main.py”, line 38, in
    from extensions.googlemaps import Googlemaps
    File “/usr/lib/python2.5/site-packages/pytrainer/extensions/googlemaps.py”, line 19, in
    import gtkmozembed
    ImportError: No module named gtkmozembed

  10. I think I find the package, python-gnome2-extras. So run
    sudo apt-get install python-gnome2-extras

    At least, my pytrainer won’t start when I remove the package, and fails with “ImportError: No module named gtkmozembed”.

    So hope that will do the trick for you? :)

  11. Thanks… Now I got it working!

    Just another question, how does the worldpress extension works? Is there any user manual out there? Or is there any other “easy” way to put up your training on an own homepage? Remember that I did it long time ago with SportSim…

    Br,

    Lars

  12. Hi, I hope someone can help…

    I have installed Pytrainer on a AMD 64 machine running Mint Linux’s XFCE addition (it is the latest Beta but should be full release this week so seems pretty stable).

    Anyway I saw above you could use Ubuntu’s Repositories and install the Gutsy version in Hardy (which mint is based on).

    I installed everything and the dependancies via Synaptic but on start up nothing happens. Running from the terminal I get this trace…

    nick@nick ~ $ pytrainer
    Traceback (most recent call last):
    File “/usr/bin/pytr”, line 38, in
    from pytrainer.main import pyTrainer
    File “/usr/lib/python2.5/site-packages/pytrainer/main.py”, line 38, in
    from extensions.googlemaps import Googlemaps
    File “/usr/lib/python2.5/site-packages/pytrainer/extensions/googlemaps.py”, line 19, in
    import gtkmozembed
    ImportError: No module named gtkmozembed

    I searched the net and found a suggestion to install firefox-dev to install gtkmozembed but I still get the same error.

    Any help would be greatly appreciated. I am doing a new ride in the jungle round KL and want to know where I have been!

    Nick

  13. Hi Nick

    As I suggested July 9th, 2008 at 20:42, you have to install python-gnome2-extras:

    sudo apt-get install python-gnome2-extras

    Regards
    Christoffer

  14. Lars > I have no idea about the WordPress plugin – I have never used it!

  15. What a idiot… Ask a question and there is the same one 3 posts up!

    Seems to be working now and loving it. Thanks for not flaming me ;-)

    Nick

  16. Hi Lars and others

    I have been trying to get the Pytrainer WordPress extension to work – unfortunately with no success.
    There is only a limited help to find. I get an empty error message, when i try to upload data. If i run pytrainer from a console, i get several errors – some indicating a bug.
    So if anyone finds anything about pytrainers wordpress extension, i would bee happy to know. Maybe we can solve the problem together.

  17. I cant even figure out how to use the WordPress extension :)

    But maybe this Swedish blog can help: http://webbservern.se/~jonas/wordpress/?p=712 ?

  18. Thx – im not sure if he has a solution, but now i have written a note to him then lets see.

  19. Ok, er det meningen at den poster til WordPress hver gang man indtaster en ny træningstid?

  20. Jeg ved det ikke med sikkerhed. Det jeg har set er, at hver aktivitet får en ny mulighed for at offentliggøre aktiviteten på wordpress bloggen.
    Man skal bl.a. bruge en nøgle til Google maps, så jeg forventer, at man offentliggør ruten i bloggen, sammen med andre data.
    Den svensker du linkede til, skriver desuden, at han har eksperimenteret med at ændre på, hvilke data der lægges op.

    Nu må vi se om han svarer.

  21. i need to install phython-gnome2-extras in order to install Vodafone connection manager for E220. but when i downloaded it and try to install, it shows me some dependent packages.

    So how can i install phython-gnome2-extras to my machine with whatever other required packages to install E220 software.

    thanks

  22. If you are running Ubuntu, just type:
    sudo apt-get install python-gnome2-extras

    And dependencies will be downloaded and installed together with python-gnome2-extras.

  23. hi, thanks for the tip. but when i tried it i have following result. please help.

    sudo: unable to resolve host scm-61-91
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    Package python-gnome2-extras is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source
    However the following packages replace it:
    python-gnome2-desktop python-gtkhtml2
    E: Package python-gnome2-extras has no installation candidate

  24. and when i try to update

    sudo apt-get update

    it give me proxy Authentication error message (407)
    Err http://lk.archive.ubuntu.com hardy/main Packages
    407 Proxy Authentication Required
    Err http://lk.archive.ubuntu.com hardy/restricted Packages
    407 Proxy Authentication Required
    Err http://lk.archive.ubuntu.com hardy/main Sources
    407 Proxy Authentication Required
    Err http://lk.archive.ubuntu.com hardy/restricted Sources
    407 Proxy Authentication Required
    Err http://lk.archive.ubuntu.com hardy/universe Packages
    407 Proxy Authentication Required
    Err http://lk.archive.ubuntu.com hardy/universe Sources
    407 Proxy Authentication Required
    Err http://lk.archive.ubuntu.com hardy/multiverse Packages
    407 Proxy Authentication Required
    and lot more..

    what can be the reason. im connected through LAN with a proxy that doesn’t need authentication.. jst the machine IP is allowed to go through from the Proxy (172.22.61.30).

    how can i update Ubuntu 8.04 with Python wanted to install VMC software.

    appreciate help.

  25. Well, apt-get says there is an issue with the Proxy, so there might be some problem with the proxy.

    Try this thread http://ubuntuforums.org/showthread.php?t=96802, it might help you.

  26. Jeg har nu løst, eller rettere, lokaliseret mit problem med upload fra pytrainer til WordPress.
    Jeg bruger den danske udgave af wordpress – det giver et problem. Jeg har lavet en ny test installation af en ren engelsk udgave af WP og så kører tingene som de skal.
    Så nu vil jeg forsøge at skifte den danske ud.

  27. Tænk simpelt! Hvor mange gange skal man gøre den fejl her i livet, at man altid leder de mest komplicerede steder først.
    Nu har jeg løst mit problem med den evigt tilbagevendendende gpx.txt advarsel!

    I WP findes der under indstillinger /skrivning et afkrydsningsfelt XML-RPC. Dette felt skal afkrydses før tingene virker.

    Nu kører tingene, som de skal.

    Det betyder, at man efter at have læst data ind i pytrainer fra uret, kan vælge at offentliggøre turen på bloggen med et klik. Det er altså smart!

  28. Cool, det må jeg hellere få kigget lidt på.

    Jeg kiggede lige på http://min-avis.dk/ole/?p=266, og det ser jo ganske godt ud. Ser også ud til at være en ret ok løberute du har fundet der :)

  29. Ja, systemet fungerer. Jeg ville ønske, at skaleringen var lidt bedre. Ruten kunne godt fylde lidt mere på kortet, så læseren ikke selv skal zoom ind., Det kan jeg måske løse senere.

    Det er en dejlig løberute – ingen tvivl om det. Den ligger lige uden for døren, så det er jo også en fordel. :) Men den smukkeste jeg endnu har løbet, er nu en gang Molsløbets rute(r). Jeg har skrevet om ruten i “Runners High” på bloggen.
    Jeg bliver ved med at længes derud, selv om det også er noget af det hårdeste, jeg har oplevet i forbindelse med mit løb. Jeg regner med at skulle derud om ca. 14 dage igen og løbe ½ marathon-ruten.
    Jeg kan varmt anbefale den 11 km-eren, eller 6 km. eren, hvis du er til løb i smukke omgivelser. Alle 3 starter med næsten 100 meter stigning inde i skov: :)

  30. Der er bare så langt til Mols herfra, og så er bakker ikke lige mig :)

    Men hvis du en dag kommer til Sjælland for at løbe, så skulle du prøve Griseløbet, http://www.snikatletik.dk/default.asp?clicked=2042, det er også en ganske ok rute.

  31. Hi

    Now I’m getting back to you because I need some help again…

    My normal computer has left “earth” (RIP) and while I’m waiting for a new stationary computer I’ve both a eeepc that I’ve installed Intrepid Ibex. I’ve also installed pytrainer followed your instruction above.

    So, I start the terminal and write
    sudo modprobe garmin_gps

    and when I look in the log file it says the following.

    Nov 4 14:12:33 lars-laptop kernel: [ 342.488128] usb 2-2: new full speed USB device using uhci_hcd and address 3
    Nov 4 14:12:33 lars-laptop kernel: [ 342.710282] usb 2-2: configuration #1 chosen from 1 choice
    Nov 4 14:12:33 lars-laptop kernel: [ 342.714106] garmin_gps 2-2:1.0: Garmin GPS usb/tty converter detected
    Nov 4 14:12:33 lars-laptop kernel: [ 342.714894] usb 2-2: Garmin GPS usb/tty converter now attached to ttyUSB0

    I change the settings in Pytrainer and enables the Garmin heartrate gps plugin. However the Pytrainer just freezes when I try to import an workout.

    Could you help me with this one ?

    Br,

    Lars

  32. Hi Lars

    I haven’t had time to install Ibex, so I cant help you with that :)

    However, I might get time to reinstall this weekend, and will look into it then.

    Regards
    Christoffer

  33. Hi! Christoffer!

    Now I need your help again… I used pytrainer without any problem for a while, but now I get this “error” when trying to import data.

    “/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 44, 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: ”

    The only thing I know that could be a link to this is that I installed Virtualbox and in the same time recompiled the kernel…

    Could you help me getting pytrainer to work again ?

    Br, Lars

  34. Hi Lars

    I have the exact same problem in Ibex: http://ostehamster.dk/blog/index.php/2008/11/09/pytrainer-in-ubuntu-810-ibex-intrepid/#comment-669

    Are you running Ibex og Hardy?
    Are you using the OpenSource version of VirtualBox?

    I installed the official VirtualBox, and after that gps_babel stopped working. The VirtualBox package from Ubuntu, which is the opensource version with no USB support didn’t give this problem.

  35. Cool, just solved the problem by removing VirtualBox, but it might be enough to stop the VirtualBox kernel module:
    sudo /etc/init.d/virtualbox stop

  36. Tried

    sudo /etc/init.d/vboxdrv stop
    * Stopping VirtualBox kernel module
    * done.

    Without success. Well I try to uninstall VirtualBox then ( and yes I have the official one with USB support…)

    Br,

  37. I am quite sure it is VirtualBox. My setup haven’t worked for 6 days now, and I have set two new PR since it stopped working, so have tried quite hard to get it to work :)

  38. Yes without VirtualBox it’s running again…

    Thanks.

    /lars

  39. Cool. Or, it is not cool at all, but it is nice that gps_babel is running again. Will fill in a bug-report at VirtualBox.

    Do you run Ibex or Hardy?

  40. Ibex… And I think the reason for that it was not possible to import data when i turned off the virtualbox with “vboxdrv stop” is that when I uninstalled VirtualBox I needed to reboot also to make pytrainer to work.

    Br,

  41. Hmm, I did not have to reboot, just uninstall.

  42. Ok, I have another question, how do you install the “UBUNTU VirtualBox” I add it at “add/remove software” but when I try to run it I got an error


    Could not load the settings file ‘/home/lars/.VirtualBox/VirtualBox.xml’.
    Cannot convert settings from version ’1.6-linux’.
    The source version is not supported.

    Resultatkod:
    NS_ERROR_FAILURE (0×80004005)
    Komponent:
    VirtualBox
    Gränssnitt:
    IVirtualBox {557a07bc-e6ae-4520-a361-4a8493199137}

    As a comment I’m using the eeepc kernel 2.6.27-8-eeepc

    Br,

    Lars

  43. I don’t have VirtualBox installed at all anymore, but it could look like it is just the configuration file that don’t work, because it is in a never version.

  44. Hi,

    following problem under Kubuntu 8.04: I’m not able to open a gpx file. I tried the files generated by two different programs (SportTracker and TreckBuddy) but none worked. I also tried to modify the time string but without success. I get the following output from pytrainer 1.5.001:

    Traceback (most recent call last):
    File “/usr/lib/python2.5/site-packages/pytrainer/gui/windowrecord.py”, line 200, in n_calculatevalues_clicked
    self.parent.actualize_fromgpx(gpxfile)
    File “/usr/lib/python2.5/site-packages/pytrainer/record.py”, line 183, in actualize_fromgpx
    gpx = Gpx(self.data_path,gpxfile)
    File “/usr/lib/python2.5/site-packages/pytrainer/lib/gpx.py”, line 39, in __init__
    self.Values = self._getValues()
    File “/usr/lib/python2.5/site-packages/pytrainer/lib/gpx.py”, line 131, in _getValues
    mk_time = time.strptime(time_, “%Y-%m-%dT%H:%M:%SZ”)
    File “/usr/lib/python2.5/_strptime.py”, line 330, in strptime
    (data_string, format))
    ValueError: time data did not match format: data=2009-01-22T08:27:07.10 fmt=%Y-%m-%dT%H:%M:%SZ

    Any ideas?
    Thanks, Matthias

  45. Different gpx files has different content, and you have to use the one from gpsbabel – as far as I know…

  46. Hi,

    Now there’s problem again. Has upgraded to 9.04 and then I format everything to get ext4. But when I try to install Pytrainer again It cant find the e-oss.net . So I tried to download and following the instruction from SorceForge (Pytrainer 1.6.0.8) But I get the following errors, could you help?

    lars@lars-laptop:~$ ./pytrainer.sh -i
    bash: ./pytrainer.sh: Filen eller katalogen finns inte
    lars@lars-laptop:~$ cd pytrainer-1.6.0.8/
    lars@lars-laptop:~/pytrainer-1.6.0.8$ ./pytrainer.sh -ilocation: /usr/lib/xulrunner-1.9.0.10/libxpcom.so
    before 3
    this function is obsolete, use getValue instead
    Traceback (most recent call last):
    File “pytrainer.py”, line 54, in
    main(sys.argv[1:])
    File “pytrainer.py”, line 50, in main
    pytrainer = pyTrainer(None, data_path)
    File “/home/lars/pytrainer-1.6.0.8/pytrainer/main.py”, line 115, in __init__
    self.webservice = webService(data_path,self.refreshWaypointView,self.newRecord)
    File “/home/lars/pytrainer-1.6.0.8/pytrainer/lib/soapUtils.py”, line 33, in __init__
    self.server = SOAPpy.ThreadingSOAPServer((“localhost”, 8081))
    File “/var/lib/python-support/python2.6/SOAPpy/Server.py”, line 676, in __init__
    SocketServer.ThreadingTCPServer.__init__(self, addr, RequestHandler)
    File “/usr/lib/python2.6/SocketServer.py”, line 400, in __init__
    self.server_bind()
    File “/usr/lib/python2.6/SocketServer.py”, line 411, in server_bind
    self.socket.bind(self.server_address)
    File “”, line 1, in bind
    socket.error: [Errno 98] Adressen redan upptagen

    Br, Lars

  47. Hi Lars

    I stopped using pytraier some mouth ago, because I got tired of the software, and because the Forerunner can show almost everything I need right now.

    When I want to extract data I use http://code.google.com/p/garmintools/ and I might start building (or help building) a GUI for this project.

    So sorry, can’t help you there. Expect that you might wanna check if some other server is running on 8081?

    br
    Christoffer


Læg en kommentar