fitfile
raw JSON → 1.2.0 verified Sat May 09 auth: no python maintenance
Python library for decoding and reading Garmin FIT file format data. Current version 1.2.0, no longer actively updated (use 'fitdecode' or 'garmin-fit' instead).
pip install fitfile Common errors
error ImportError: cannot import name 'FitFile' ↓
cause Wrong import path or version mismatch.
fix
Use: from fitfile import FitFile
error AttributeError: 'FitFile' object has no attribute 'get_messages' ↓
cause Trying to call get_messages on the wrong object or old version.
fix
Ensure fitfile >= 1.0; use fit.get_messages() not FitFile.get_messages()
Warnings
deprecated fitfile is no longer actively maintained. Consider using fitdecode or garmin-fit for new projects. ↓
fix pip install fitdecode then use from fitdecode import FitReader
gotcha Common mistake: calling get_messages() multiple times re-reads the file. Must re-open or store list. ↓
fix messages = list(fit.get_messages()) # store once
breaking Removed Python 2 support. Requires Python >= 3.0 ↓
fix Use Python 3.
Imports
- FitFile
from fitfile import FitFile - FIT_TYPE
from fitfile import FIT_TYPE
Quickstart
from fitfile import FitFile
with open('activity.fit', 'rb') as f:
fit = FitFile(f)
for record in fit.get_messages():
if record.name == 'record':
print(record.get('heart_rate', None))