catching FitHeaderError
This commit is contained in:
@@ -72,6 +72,7 @@ import pandas as pd
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
import itertools
|
import itertools
|
||||||
from fitparse import FitFile
|
from fitparse import FitFile
|
||||||
|
from fitparse.base import FitHeaderError
|
||||||
import math
|
import math
|
||||||
from rowers.tasks import (
|
from rowers.tasks import (
|
||||||
handle_sendemail_unrecognized, handle_sendemail_breakthrough,
|
handle_sendemail_unrecognized, handle_sendemail_breakthrough,
|
||||||
@@ -1586,7 +1587,11 @@ def handle_nonpainsled(f2, fileformat, summary=''):
|
|||||||
# Currently there is code duplication
|
# Currently there is code duplication
|
||||||
|
|
||||||
def get_workouttype_from_fit(filename,workouttype='water'):
|
def get_workouttype_from_fit(filename,workouttype='water'):
|
||||||
fitfile = FitFile(filename,check_crc=False)
|
try:
|
||||||
|
fitfile = FitFile(filename,check_crc=False)
|
||||||
|
except FitHeaderError:
|
||||||
|
return workouttype
|
||||||
|
|
||||||
records = fitfile.messages
|
records = fitfile.messages
|
||||||
fittype = 'rowing'
|
fittype = 'rowing'
|
||||||
for record in records:
|
for record in records:
|
||||||
|
|||||||
Reference in New Issue
Block a user