geo-activity-playground icon indicating copy to clipboard operation
geo-activity-playground copied to clipboard

Error with `.fit` activities with NoneType subsport

Open antonmosich opened this issue 1 year ago • 4 comments

I just tried out running 0.17.1 and encountered the following error:

Parse activity files:   2%|█                                                       | 203/11221 [00:08<02:02, 90.08it/s]2024-01-13 12:28:25 geo_activity_playground.importers.directory ERROR Encountered a problem with path=PosixPath('Activities/filename.fit'), see details below.
Parse activity files:   2%|█                                                       | 207/11221 [00:08<07:30, 24.47it/s]
Traceback (most recent call last):
  File "/nix/store/88a9n13fznshkf45x2a9sd5fcy27vr6p-geo-activity-playground-0.17.1/bin/.geo-activity-playground-wrapped", line 9, in <module>
    sys.exit(main())
             ^^^^^^
  File "/nix/store/88a9n13fznshkf45x2a9sd5fcy27vr6p-geo-activity-playground-0.17.1/lib/python3.11/site-packages/geo_activity_playground/__main__.py", line 95, in main
    options.func(options)
  File "/nix/store/88a9n13fznshkf45x2a9sd5fcy27vr6p-geo-activity-playground-0.17.1/lib/python3.11/site-packages/geo_activity_playground/__main__.py", line 70, in <lambda>
    make_activity_repository(options.basedir),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/88a9n13fznshkf45x2a9sd5fcy27vr6p-geo-activity-playground-0.17.1/lib/python3.11/site-packages/geo_activity_playground/__main__.py", line 103, in make_activity_repository
    import_from_directory()
  File "/nix/store/88a9n13fznshkf45x2a9sd5fcy27vr6p-geo-activity-playground-0.17.1/lib/python3.11/site-packages/geo_activity_playground/importers/directory.py", line 41, in import_from_directory
    activity_meta_from_file, timeseries = read_activity(path)
                                          ^^^^^^^^^^^^^^^^^^^
  File "/nix/store/88a9n13fznshkf45x2a9sd5fcy27vr6p-geo-activity-playground-0.17.1/lib/python3.11/site-packages/geo_activity_playground/core/activity_parsers.py", line 44, in read_activity
    metadata, timeseries = read_fit_activity(path, opener)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/88a9n13fznshkf45x2a9sd5fcy27vr6p-geo-activity-playground-0.17.1/lib/python3.11/site-packages/geo_activity_playground/core/activity_parsers.py", line 175, in read_fit_activity
    metadata["kind"] += " " + values["sub_sport"]
                        ~~~~^~~~~~~~~~~~~~~~~~~~~
TypeError: can only concatenate str (not "NoneType") to str

I tried packaging geo-activity-playground in nix, so that's why the paths for the files are the way they are, but this shouldn't be causing this issue. I can send you the activity file via some other channel if you want that.

antonmosich avatar Jan 13 '24 11:01 antonmosich