dtcooper / python-fitparse

Python library to parse ANT/Garmin .FIT files

Home Page:http://pythonhosted.org/fitparse/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FitParseError invalid field size 227 for type 'sint32'

sanderroosendaal opened this issue · comments

After upgrading fitparse to the latest (master branch), one of my standard test files fails to parse. This is a file produced by a NK SpeedCoach GPS 2 device. The file parses well on SportTracks, Strava, etc.

C:\Users\e408191\AppData\Local\Continuum\Anaconda2\lib\site-packages\fitparse\base.pyc in _parse_definition_message(self, header)
196 # examples in the wild. For now, just throw an exception
197 raise FitParseError("Invalid field size %d for type '%s' (expected a multiple of %d)" % (
--> 198 field_size, base_type.name, base_type.size))
199
200 # If the field has components that are accumulators

FitParseError: Invalid field size 227 for type 'sint32' (expected a multiple of 4)

3x250m.zip

My last successful build was 12 days ago

I've tried scripts\fitdump 3x250m.fit and it has processed without any error. What version of Python do you use? How to you use fitparse (e.g. do you use fitdump or your own python code?).

Here is some example code that gives the error (Python 2.7):

from fitparse import FitFile

f = '../testdata/3x250m.fit'
fitfile = FitFile(f,check_crc=False)
fitfile.parse()

When I git checkout 5d8bb3a everything is fine.

What exact version returns python --version ?

On my local system: Python 2.7.12 :: Anaconda 4.2.0 (64-bit)
On Travis-CLI - 2.7.10

Got the error on a different machine with Python 2.7.12 (do not understand, why my installation of 2.7.12 works): TypeError: The basestring type cannot be instantiated. Probably duplicate of #65

The error is caused by the str shim, already discussed in #58. @pR0Ps I will remove the shim from master, OK? I won't do any try_int, the caller (user) has to input proper type.

I've made a PR to fix this. Also, travis builds would make the contributing to this project much easier, see #40.