pytrainer / pytrainer

pytrainer is a desktop application for logging and graphing sporting activities such as running or cycling sessions. Data can be imported from GPS devices, files or input manually. Currently pytrainer supports GPX, TCX, and FIT files.
GNU General Public License v2.0
128 stars 41 forks source link

can not import from Forerunner 305 #32

Open tobiasdf opened 10 years ago

tobiasdf commented 10 years ago

Hi, i can not import my Garmin Forerunner 305 logs anymore. It looks like it imports some some data, but it seems like it imports wrong information or the dump file gets converted wrong. It is right, that the watch has 3 logs stored inside, check the log. Is there any way to get the import in pytrainer working again ?

pytrainer -i running pytrainer from egg installation data_path: /usr/local/share/pytrainer/ gettext_path: /usr/local/share/locale site_path: /usr/local/lib/python2.7/site-packages ERROR:root:Failed when retrieving Min Heartrate value: invalid literal for int() with base 10: '' INFO:root:Setting Min Heartrate to default value: 65 INFO:root:Initializing data. Data state is: 'CURRENT'. INFO:root:Loading plugin Garmin via garmintools INFO:root:Found Forerunner305 Software Version 2.90 INFO:root:Found files: 38 INFO:root:Retrieved 38 entries from GPS device INFO:root:Discarding entries older than 365 days INFO:root:Dumping 28 binary files found INFO:root:Starting import. Comparison will be made with 195 seconds interval INFO:root:Marking /home/user/.pytrainer/tmp/2014/03/20140327T190819.dump | 2014-03-27T18:08:22Z to import INFO:root:Marking /home/user/.pytrainer/tmp/2014/04/20140413T095230.dump | 2014-04-13T07:52:30Z to import INFO:root:Marking /home/user/.pytrainer/tmp/2014/04/20140404T161914.dump | 2014-04-04T14:19:13Z to import INFO:root:Entries to import: 3 INFO:root:File exists. Size: 1334. Sport: Biking INFO:root:Retrieving data from /home/user/.pytrainer/tmp/garmintools-0.gpx INFO:root:Lap distance: 0.00000000 m | Duration: 4.04 s | Calories: 0 kcal INFO:root:Laps - Distance: 0.00 km | Duration: 4 s | Calories: 0 kcal INFO:root:Values - Distance: 0.01 km | Duration: 4 s | Calories: 0 kcal INFO:root:Found time: 4.04, start lat: , start lon: , end lat: end lon: cal: 0 dist: 0.00000000 INFO:root:Intensity: active | Trigger: manual | Max speed: 0.00000000 | Average hr: None | Maximum hr: None Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/pytrainer/main.py", line 189, in runPlugin if self.record.importFromGPX(pluginFile, sport) is None: File "/usr/local/lib/python2.7/dist-packages/pytrainer/record.py", line 573, in importFromGPX entry_id = self.insertNewRecord(gpxFile, entry) File "/usr/local/lib/python2.7/dist-packages/pytrainer/record.py", line 190, in insertNewRecord (list_options, gpx_laps) = self.summaryFromGPX(gpxOrig, entry) File "/usr/local/lib/python2.7/dist-packages/pytrainer/record.py", line 288, in summaryFromGPX lap_avg_hr, lap_max_hr = self.hrFromLaps(laps) File "/usr/local/lib/python2.7/dist-packages/pytrainer/record.py", line 228, in hrFromLaps if int(lap['max_hr']) > lap_max_hr: TypeError: int() argument must be a string or a number, not 'NoneType'

when i check the files : /.pytrainer/tmp/2014/03/20140327T190819.dump <- file is not there, there is a 20140414T182449.dump instead /.pytrainer/tmp/2014/04/20140404T161914.dump <- data seems to be correct /.pytrainer/tmp/2014/04/20140413T095230.dump <- data seems to be correct

dgranda commented 10 years ago

Thanks for feedback.

I don't expect your issue is related to new versions of software, but it is always a good idea to provide version numbers to faster discards known issues.

It's long time since I used garmintools, but I think it would be a good idea to remove files from /.pytrainer/tmp/ if pytrainer doesn't delete them.

From your log, it seems dump file /home/user/.pytrainer/tmp/2014/03/20140327T190819.dump is converted into /home/user/.pytrainer/tmp/garmintools-0.gpx and after that dump one disappears.

What I am trying to figure out is if the output from garmintools is a valid gpx file, because pytrainer only accepts valid ones as it needs to rely on valid data.

From the output in log file it seems a pretty strange one, it seems an indoor activity:

INFO:root:File exists. Size: 1334. Sport: Biking
INFO:root:Retrieving data from /home/user/.pytrainer/tmp/garmintools-0.gpx
INFO:root:Lap distance: 0.00000000 m | Duration: 4.04 s | Calories: 0 kcal
INFO:root:Laps - Distance: 0.00 km | Duration: 4 s | Calories: 0 kcal
INFO:root:Values - Distance: 0.01 km | Duration: 4 s | Calories: 0 kcal
INFO:root:Found time: 4.04, start lat: , start lon: , end lat: end lon: cal: 0 dist: 0.00000000
INFO:root:Intensity: active | Trigger: manual | Max speed: 0.00000000 | Average hr: None | Maximum hr: None
tobiasdf commented 10 years ago

Hi, thank you for replying

i've deleted the /tmp/ folder, and int looks like it sloved some issues i had with pytrainer. One track could be Imported. When i try to import the other 2 gpx files manual, it seems they are not Valid, i can only see the date in the Preview but no details. This looks like an Error of Garmintools ? Because the watch shows me all information about this tracks.

dgranda commented 10 years ago

Without more detailed information it is quite difficult to say where the error occurs: maybe the xml is malformed, maybe the import in pytrainer fails, maybe pytrainer's database got corrupted from previous operations, etc.

One useful way to check if xml file is valid is using xmllint

avtobiff commented 5 years ago

Is this still an issue?