Coder Social home page Coder Social logo

Comments (17)

tcgoetz avatar tcgoetz commented on July 17, 2024

You have an activity in a Tcx file that has altitude entries, but the entries are empty. That isn't something I expected. Making a fix.

from garmindb.

tcgoetz avatar tcgoetz commented on July 17, 2024

Try: https://github.com/tcgoetz/GarminDB/releases/tag/v1.2.5

If you get an error again, please post the new error.

from garmindb.

jentera avatar jentera commented on July 17, 2024

Hi, thanks for looking into this. I'm using Mac v1.2.5 binary now, but still got the same error:

Processing activities tcx data
 14% (10 of 71) |###                     | Elapsed Time: 0:00:35 ETA:   0:03:29Traceback (most recent call last):
  File "garmin.py", line 389, in <module>
  File "garmin.py", line 379, in main
  File "garmin.py", line 202, in import_data
  File "import_garmin_activities.py", line 165, in process_files
  File "import_garmin_activities.py", line 112, in __process_file
  File "Tcx/tcx.py", line 195, in read
  File "Tcx/tcx.py", line 177, in update
  File "Tcx/tcx.py", line 148, in __tag_values
  File "Tcx/tcx.py", line 148, in <listcomp>
AttributeError: 'NoneType' object has no attribute 'strip'
[15692] Failed to execute script garmin

Btw, I also tried to build using ubuntu 18.04 using commit 8d94016 via ssh git clone. After successful make setup, during make create_dbs I got this:

Processing FileType.monitoring_b FIT data from /home/koding/HealthData/FitFiles/Monitoring
100% (117 of 117) |########################| Elapsed Time: 0:00:27 Time:  0:00:27
Processing sleep data
100% (32 of 32) |##########################| Elapsed Time: 0:00:00 Time:  0:00:00
Processing rhr data
100% (32 of 32) |##########################| Elapsed Time: 0:00:00 Time:  0:00:00
Processing activities tcx data
 14% (10 of 71) |###                       | Elapsed Time: 0:00:10 ETA:   0:01:11Traceback (most recent call last):
  File "garmin.py", line 387, in <module>
    main(sys.argv[1:])
  File "garmin.py", line 377, in main
    import_data(debug, latest, weight, monitoring, sleep, rhr, activities, test)
  File "garmin.py", line 202, in import_data
    gtd.process_files(db_params_dict)
  File "/home/koding/GarminDB/import_garmin_activities.py", line 165, in process_files
    self.__process_file(file_name)
  File "/home/koding/GarminDB/import_garmin_activities.py", line 112, in __process_file
    tcx.read(file_name)
  File "/home/koding/GarminDB/Tcx/tcx.py", line 195, in read
    self.update()
  File "/home/koding/GarminDB/Tcx/tcx.py", line 177, in update
    self.altitude_values = self.__tag_values(float, './/ns:AltitudeMeters')
  File "/home/koding/GarminDB/Tcx/tcx.py", line 148, in __tag_values
    return [type_func(value.text.strip()) for value in self.__findall(self.activity, tag_path, namespace) if value is not None]
  File "/home/koding/GarminDB/Tcx/tcx.py", line 148, in <listcomp>
    return [type_func(value.text.strip()) for value in self.__findall(self.activity, tag_path, namespace) if value is not None]
AttributeError: 'NoneType' object has no attribute 'strip'
100% (71 of 71) |##########################| Elapsed Time: 0:00:10 Time:  0:00:10
Command exited with non-zero status 1
/usr/bin/time
Makefile:128: recipe for target 'update_garmin' failed
make: *** [update_garmin] Error 1

from garmindb.

tcgoetz avatar tcgoetz commented on July 17, 2024

Please update your ubuntu tree and try again. You should see commit
ccce27d in your Tcx repo. Please reply with success or any new error. Thanks!

from garmindb.

jentera avatar jentera commented on July 17, 2024

Now I got this:

Processing activities tcx data
 14% (10 of 71) |###                       | Elapsed Time: 0:00:23 ETA:   0:02:14Traceback (most recent call last):
  File "garmin.py", line 387, in <module>
    main(sys.argv[1:])
  File "garmin.py", line 377, in main
    import_data(debug, latest, weight, monitoring, sleep, rhr, activities, test)
  File "garmin.py", line 202, in import_data
    gtd.process_files(db_params_dict)
  File "/home/koding/GarminDB/import_garmin_activities.py", line 165, in process_files
    self.__process_file(file_name)
  File "/home/koding/GarminDB/import_garmin_activities.py", line 156, in __process_file
    self.__process_lap(tcx, file_id, lap_number, lap)
  File "/home/koding/GarminDB/import_garmin_activities.py", line 96, in __process_lap
    'start_time'                        : tcx.get_lap_start(lap),
  File "/home/koding/GarminDB/Tcx/tcx.py", line 266, in get_lap_start
    return self.get_point_time(self.get_lap_points(lap)[0])
IndexError: list index out of range
100% (71 of 71) |##########################| Elapsed Time: 0:00:23 Time:  0:00:23
Command exited with non-zero status 1
/usr/bin/time
Makefile:116: recipe for target 'garmin' failed
make: *** [garmin] Error 1

Perhaps there's something wrong with my data in Connect? Now it's lap time?

from garmindb.

tcgoetz avatar tcgoetz commented on July 17, 2024

Tcx files are not usually from Garmin Connect itself. All of the times GC gave me Tcx files was for activities I imported from somewhere else. Tcx files have a lot of variations. Your showing me examples of things I haven't seen before. I'll keep fixing them and hopefully we will have all of your cases covered shortly.

from garmindb.

tcgoetz avatar tcgoetz commented on July 17, 2024

Next round of fixes: a6ff1bc.

Do a make update and try again.

from garmindb.

jentera avatar jentera commented on July 17, 2024

Hi. Still got another error. I noticed from Connect dashboard that the TCXs processed below doesn't have HR data and the "Elapsed Time" is 0:00.

Processing daily hydration data
100% (13 of 13) |##########################| Elapsed Time: 0:00:00 Time:  0:00:00
Processing FileType.monitoring_b FIT data from /home/koding/HealthData/FitFiles/Monitoring
100% (217 of 217) |########################| Elapsed Time: 0:01:09 Time:  0:01:09
Processing sleep data
100% (13 of 13) |##########################| Elapsed Time: 0:00:05 Time:  0:00:05
Processing rhr data
100% (13 of 13) |##########################| Elapsed Time: 0:00:00 Time:  0:00:00
Processing activities tcx data
 14% (10 of 71) |###                       | Elapsed Time: 0:00:28 ETA:   0:03:03Exception processing file /home/koding/HealthData/FitFiles/Activities/909019240.tcx: 'NoneType' object has no attribute 'lat_deg'
 15% (11 of 71) |####                      | Elapsed Time: 0:00:28 ETA:   0:01:33Exception processing file /home/koding/HealthData/FitFiles/Activities/909019336.tcx: 'NoneType' object has no attribute 'lat_deg'
 16% (12 of 71) |####                      | Elapsed Time: 0:00:28 ETA:   0:01:32Exception processing file /home/koding/HealthData/FitFiles/Activities/909019388.tcx: 'NoneType' object has no attribute 'lat_deg'
 18% (13 of 71) |####                      | Elapsed Time: 0:00:28 ETA:   0:00:47Exception processing file /home/koding/HealthData/FitFiles/Activities/909019453.tcx: 'NoneType' object has no attribute 'lat_deg'
100% (71 of 71) |##########################| Elapsed Time: 0:03:10 Time:  0:03:10
Processing all activities summary data from /home/koding/HealthData/FitFiles/Activities
100% (188 of 188) |########################| Elapsed Time: 0:00:05 Time:  0:00:05
Processing activities detail data
100% (188 of 188) |########################| Elapsed Time: 0:00:06 Time:  0:00:06
Processing activities extra data
Processing FileType.activity FIT data from /home/koding/HealthData/FitFiles/Activities
N/A% (0 of 116) |                          | Elapsed Time: 0:00:00 ETA:  --:--:--Traceback (most recent call last):
  File "garmin.py", line 387, in <module>
    main(sys.argv[1:])
  File "garmin.py", line 377, in main
    import_data(debug, latest, weight, monitoring, sleep, rhr, activities, test)
  File "garmin.py", line 218, in import_data
    gfd.process_files(db_params_dict)
  File "/home/koding/GarminDB/fit_data.py", line 54, in process_files
    fp.write_file(fit_file)
  File "/home/koding/GarminDB/fit_file_processor.py", line 83, in write_file
    self.__write_message_types(fit_file, fit_file.message_types())
  File "/home/koding/GarminDB/fit_file_processor.py", line 71, in __write_message_types
    self.__write_message_type(fit_file, message_type)
  File "/home/koding/GarminDB/fit_file_processor.py", line 57, in __write_message_type
    function(fit_file, message_type, messages)
  File "/home/koding/GarminDB/fit_file_processor.py", line 46, in __write_generic
    function(fit_file, message_dict)
  File "/home/koding/GarminDB/fit_file_processor.py", line 266, in _write_session_entry
    sub_sport = message_dict['sub_sport']
KeyError: 'sub_sport'
100% (116 of 116) |########################| Elapsed Time: 0:00:02 Time:  0:00:02
Command exited with non-zero status 1
/usr/bin/time
Makefile:116: recipe for target 'garmin' failed
make: *** [garmin] Error 1

Thanks

from garmindb.

tcgoetz avatar tcgoetz commented on July 17, 2024

Couple more fixes. Please try again.

from garmindb.

jentera avatar jentera commented on July 17, 2024

Now I got this:

Processing FileType.monitoring_b FIT data from /home/koding/HealthData/FitFiles/Monitoring
100% (207 of 207) |##############################################################| Elapsed Time: 0:01:34 Time:  0:01:34
Processing sleep data
100% (32 of 32) |################################################################| Elapsed Time: 0:00:09 Time:  0:00:09
Processing rhr data
100% (32 of 32) |################################################################| Elapsed Time: 0:00:00 Time:  0:00:00
Processing activities tcx data
100% (71 of 71) |################################################################| Elapsed Time: 0:02:49 Time:  0:02:49
Processing all activities summary data from /home/koding/HealthData/FitFiles/Activities
100% (188 of 188) |##############################################################| Elapsed Time: 0:00:03 Time:  0:00:03
Processing activities detail data
100% (188 of 188) |##############################################################| Elapsed Time: 0:00:03 Time:  0:00:03
Processing activities extra data
Processing FileType.activity FIT data from /home/koding/HealthData/FitFiles/Activities
N/A% (0 of 116) |                                                                | Elapsed Time: 0:00:00 ETA:  --:--:--Traceback (most recent call last):
  File "garmin.py", line 387, in <module>
    main(sys.argv[1:])
  File "garmin.py", line 377, in main
    import_data(debug, latest, weight, monitoring, sleep, rhr, activities, test)
  File "garmin.py", line 218, in import_data
    gfd.process_files(db_params_dict)
  File "/home/koding/GarminDB/fit_data.py", line 54, in process_files
    fp.write_file(fit_file)
  File "/home/koding/GarminDB/fit_file_processor.py", line 83, in write_file
    self.__write_message_types(fit_file, fit_file.message_types())
  File "/home/koding/GarminDB/fit_file_processor.py", line 71, in __write_message_types
    self.__write_message_type(fit_file, message_type)
  File "/home/koding/GarminDB/fit_file_processor.py", line 57, in __write_message_type
    function(fit_file, message_type, messages)
  File "/home/koding/GarminDB/fit_file_processor.py", line 46, in __write_generic
    function(fit_file, message_dict)
  File "/home/koding/GarminDB/fit_file_processor.py", line 297, in _write_session_entry
    activity.update(self.__choose_sport(current.sport, current.sub_sport, sport, sub_sport))
  File "/home/koding/GarminDB/fit_file_processor.py", line 259, in __choose_sport
    if (sub_sport is None and new_sub_sport is not None) or (not sub_sport.preferred() and new_sub_sport.preferred()):
AttributeError: 'NoneType' object has no attribute 'preferred'
100% (116 of 116) |##############################################################| Elapsed Time: 0:00:02 Time:  0:00:02
Command exited with non-zero status 1
/usr/bin/time
Makefile:116: recipe for target 'garmin' failed
make: *** [garmin] Error 1

I guess the tcx part is fixed now.

from garmindb.

tcgoetz avatar tcgoetz commented on July 17, 2024

Any chance you could share with me one or more of these files? Then I could fix all of the issue instead of one at a time.

/home/koding/HealthData/FitFiles/Activities/909019240.tcx
/home/koding/HealthData/FitFiles/Activities/909019336.tcx
/home/koding/HealthData/FitFiles/Activities/909019388.tc
/home/koding/HealthData/FitFiles/Activities/909019453.tcx

from garmindb.

tcgoetz avatar tcgoetz commented on July 17, 2024

commit e5cf943 fixes the stacktrace above.

from garmindb.

tcgoetz avatar tcgoetz commented on July 17, 2024

Are you still having issues?

from garmindb.

jentera avatar jentera commented on July 17, 2024

Hi, sorry for the late response. I still got this and I'll send you sample of tcx.

100% (188 of 188) |##############################################################| Elapsed Time: 0:00:04 Time:  0:00:04
Processing activities detail data
100% (188 of 188) |##############################################################| Elapsed Time: 0:00:03 Time:  0:00:03
Processing activities extra data
Processing FileType.activity FIT data from /home/koding/HealthData/FitFiles/Activities
N/A% (0 of 116) |                                                                | Elapsed Time: 0:00:00 ETA:  --:--:--Traceback (most recent call last):
  File "garmin.py", line 387, in <module>
    main(sys.argv[1:])
  File "garmin.py", line 377, in main
    import_data(debug, latest, weight, monitoring, sleep, rhr, activities, test)
  File "garmin.py", line 218, in import_data
    gfd.process_files(db_params_dict)
  File "/home/koding/GarminDB/fit_data.py", line 54, in process_files
    fp.write_file(fit_file)
  File "/home/koding/GarminDB/fit_file_processor.py", line 83, in write_file
    self.__write_message_types(fit_file, fit_file.message_types())
  File "/home/koding/GarminDB/fit_file_processor.py", line 71, in __write_message_types
    self.__write_message_type(fit_file, message_type)
  File "/home/koding/GarminDB/fit_file_processor.py", line 57, in __write_message_type
    function(fit_file, message_type, messages)
  File "/home/koding/GarminDB/fit_file_processor.py", line 46, in __write_generic
    function(fit_file, message_dict)
  File "/home/koding/GarminDB/fit_file_processor.py", line 297, in _write_session_entry
    activity.update(self.__choose_sport(current.sport, current.sub_sport, sport, sub_sport))
  File "/home/koding/GarminDB/fit_file_processor.py", line 261, in __choose_sport
    return {'sport' : sport.name, 'sub_sport' : sub_sport.name}
AttributeError: 'NoneType' object has no attribute 'name'
100% (116 of 116) |##############################################################| Elapsed Time: 0:00:04 Time:  0:00:04
Command exited with non-zero status 1
/usr/bin/time
Makefile:116: recipe for target 'garmin' failed
make: *** [garmin] Error 1

from garmindb.

jentera avatar jentera commented on July 17, 2024

from garmindb.

tcgoetz avatar tcgoetz commented on July 17, 2024

The above commits should resolve this error:

AttributeError: 'NoneType' object has no attribute 'name'

from garmindb.

jentera avatar jentera commented on July 17, 2024

Yes, it worked! Thank you so much.

from garmindb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.