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

Make file reading more robust #30

Open
charlieforward9 opened this issue Jun 23, 2024 · 0 comments
Open

Make file reading more robust #30

charlieforward9 opened this issue Jun 23, 2024 · 0 comments

Comments

@charlieforward9
Copy link

charlieforward9 commented Jun 23, 2024

Fit files seem to have an issue every now and then... I am using the dependent library https://github.com/dodo-saba/fit2gpx

Traceback (most recent call last):
  File "/Users/crich/development/github/NEW_HEAT/strava_parser.py", line 127, in <module>
    strava_conv.strava_fit_to_gpx()
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/fit2gpx.py", line 349, in strava_fit_to_gpx
    df_laps, df_points = self.fit_to_dataframes(self._dir_activities + f_activity)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/fit2gpx.py", line 110, in fit_to_dataframes
    for frame in fit_file:
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/fitdecode/reader.py", line 232, in __iter__
    yield from self._read_next()
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/fitdecode/reader.py", line 351, in _read_next
    self._read_header()
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/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

I tried putting the fit file into FitFileViewer as well, and got an error. However, when I try to convert the fit file to gpx with GoToes, it works without any problem.

It would be nice to have a handler that reads the fit file using the same type of error handling as gotoes, such that it does not crash the parsing.

Problematic File:
9702592680.fit.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant