#!/usr/bin/env python

# Sample usage of python-fitparse to parse an activity and
# print its data records.


from fitparse import Activity

activity = Activity("/home/cedric/Documents/Code/Sport/power-profile/data/user_1/2015/2015-08-09-13-14-05.fit")
activity.parse()

# Records of type 'record' (I know, confusing) are the entries in an
# activity file that represent actual data points in your workout.
records = activity.get_records_by_type('record')
current_record_number = 0

for record in records:
    # Print record number
    current_record_number += 1
    print (" Record #%d " % current_record_number).center(40, '-')

    # Get the list of valid fields on this record
    valid_field_names = record.get_valid_field_names()

    for field_name in valid_field_names:
        # Get the data and units for the field
        field_data = record.get_data(field_name)
        field_units = record.get_units(field_name)
        
        # Print what we've got!
        if field_units:
            print " * %s: %s %s" % (field_name, field_data, field_units)
        else:
            print " * %s: %s" % (field_name, field_data)
            
    print

@@ -124,24 +124,23 @@
  import 
-Activity
+FitFile
 %0A%0Aactivi
@@ -148,65 +148,19 @@
 y = 
-Activity(%22/home/cedric/Documents/Code/Sport/power-profile
+FitFile(%22..
 /dat
@@ -363,16 +363,21 @@
 cords = 
+list(
 activity
@@ -385,24 +385,22 @@
 get_
-records_by_type(
+messages(name=
 'rec
@@ -404,16 +404,17 @@
 record')
+)
 %0Acurrent
@@ -589,405 +589,97 @@
     
-# Get the list of valid fields on this record%0A    valid_field_names = record.get_valid_field_names()%0A%0A    for field_name in valid_field_names:%0A        # Get the data and units for the field%0A        field_data = record.get_data(field_name)%0A        field_units = record.get_units(field_name)%0A        %0A        # Print what we've got!%0A        if field_units:%0A            print %22 * %25s: %25s %25s%22 %25
+for field in record:%0A        # Get the data and units for the field%0A        print
  (field
-_
+.
 name
@@ -689,111 +689,29 @@
 ield
-_data, field_units)%0A        else:%0A            print %22 * %25s: %25s%22 %25 (field_name, field_data)%0A            
+.value, field.units)%0A
 %0A   

Change the main file to work with the new version of fitparse