Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import from Strava export crashes on broken .fit file #134

Closed
p3dda opened this issue Aug 5, 2024 · 0 comments · Fixed by #135
Closed

Import from Strava export crashes on broken .fit file #134

p3dda opened this issue Aug 5, 2024 · 0 comments · Fixed by #135
Labels
component: activity files Parsers for GPX, FIT, KML, TCX, CSV activity files type: bug Something isn't working

Comments

@p3dda
Copy link

p3dda commented Aug 5, 2024

In my Strava export, there is one obviously broken .fit file. Although the activity is shown correctly in Stravas webinterface, the file cannot be read (also not by other .fit file viewers).

During import, there is an unhandled FitHeaderError exception raised which leads to abortion of the import process:

Import from Strava export:  65%|██████▌   | 2505/3835 [00:39<00:21, 63.08it/s]
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/app/geo_activity_playground/__main__.py", line 118, in <module>
    main()
  File "/app/geo_activity_playground/__main__.py", line 93, in main
    options.func(options)
  File "/app/geo_activity_playground/__main__.py", line 67, in <lambda>
    *make_activity_repository(options.basedir, options.skip_strava),
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/geo_activity_playground/__main__.py", line 112, in make_activity_repository
    scan_for_activities(repository, tile_visit_accessor, config, skip_strava)
  File "/app/geo_activity_playground/webui/upload/controller.py", line 103, in scan_for_activities
    import_from_strava_checkout(repository)
  File "/app/geo_activity_playground/importers/strava_checkout.py", line 198, in import_from_strava_checkout
    file_activity_meta, time_series = read_activity(activity_file)
                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/geo_activity_playground/core/activity_parsers.py", line 45, in read_activity
    metadata, timeseries = read_fit_activity(path, opener)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/geo_activity_playground/core/activity_parsers.py", line 98, in read_fit_activity
    for frame in fit:
  File "/usr/local/lib/python3.11/site-packages/fitdecode/reader.py", line 232, in __iter__
    yield from self._read_next()
  File "/usr/local/lib/python3.11/site-packages/fitdecode/reader.py", line 351, in _read_next
    self._read_header()
  File "/usr/local/lib/python3.11/site-packages/fitdecode/reader.py", line 424, in _read_header
    raise FitHeaderError(f'not a FIT file @ {self._chunk_offset}')
fitdecode.exceptions.FitHeaderError: not a FIT file @ 0
@martin-ueding martin-ueding added type: bug Something isn't working component: activity files Parsers for GPX, FIT, KML, TCX, CSV activity files labels Aug 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: activity files Parsers for GPX, FIT, KML, TCX, CSV activity files type: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants