python-fitparse icon indicating copy to clipboard operation
python-fitparse copied to clipboard

Issue with end of file parsing

Open kobrien18 opened this issue 6 years ago • 3 comments

I am attempting to use fitparse to pull data from a RunScribe .fit file, and am running into an error at the end of the file: fitparse.utils.FitEOFError: Tried to read 2 bytes from .FIT file but got 1

I do not run into this issue with a Garmin .fit file. I'm using Python 3.7 on Windows 10 (64-bit) and I've attached the simplest version of the files that I believe will recreate the error.

Please let me know if there's any simple resolution to this issue, thank you!

FitParse.zip

kobrien18 avatar Jun 27 '19 17:06 kobrien18

I too am having this exact issue.

suttondaniel avatar Aug 04 '20 04:08 suttondaniel

I don't know what to make of that file - it's almost like it's corrupt or missing some data somehow. I see a file_id definition, a file_id data record (which looks fine), 5 unknown definitions, then everything else is an unknown record with unknown data in it until it errors out.

Does it parse with the FIT SDK from Garmin?

pR0Ps avatar Aug 11 '20 17:08 pR0Ps

I have written a patch with fault-tolerance for improperly terminated files. Your sample files seem to have missing header definitions, which means you cannot parse the file. I will see what I can find. https://github.com/fundthmcalculus/python-fitparse/tree/unterminated-file-fix

fundthmcalculus avatar Nov 01 '21 12:11 fundthmcalculus