diff --git a/rowers/dataroutines.py b/rowers/dataroutines.py index 94398d17..b84f5b97 100644 --- a/rowers/dataroutines.py +++ b/rowers/dataroutines.py @@ -1853,7 +1853,11 @@ def dataprep(rowdatadf, id=0, bands=True, barchart=True, otwpower=True, filename = 'media/strokedata_{id}.parquet.gz'.format(id=id) df = dd.from_pandas(data, npartitions=1) - df.to_parquet(filename, engine='fastparquet', compression='GZIP') + try: + df.to_parquet(filename, engine='fastparquet', compression='GZIP') + except FileNotFoundError: + df2 = dd.from_pandas(df, npartitions=1) + df2.to_parquet(filename, engine='fastparquet', compression='GZIP') return data diff --git a/rowers/integrations/c2.py b/rowers/integrations/c2.py index 5d948167..c718a887 100644 --- a/rowers/integrations/c2.py +++ b/rowers/integrations/c2.py @@ -165,6 +165,8 @@ class C2Integration(SyncIntegration): row = rowingdata(csvfile=filename) except IOError: # pragma: no cover return 0 + except: + return 0 try: averagehr = int(row.df[' HRCur (bpm)'].mean()) diff --git a/rowers/tasks.py b/rowers/tasks.py index d79130a5..d8880e74 100644 --- a/rowers/tasks.py +++ b/rowers/tasks.py @@ -351,10 +351,13 @@ def uploadactivity(access_token, filename, description='', name='Rowsandall.com workout'): data_gz = BytesIO() - with open(filename, 'rb') as inF: - s = inF.read() - with gzip.GzipFile(fileobj=data_gz, mode="w") as gzf: - gzf.write(s) + try: + with open(filename, 'rb') as inF: + s = inF.read() + with gzip.GzipFile(fileobj=data_gz, mode="w") as gzf: + gzf.write(s) + except FileNotFoundError: + return 0 headers = { 'Content-Type': 'application/json', diff --git a/rowers/tests/testdata/testdata.tcx.gz b/rowers/tests/testdata/testdata.tcx.gz index 3ee3d88b..5a1186ca 100644 Binary files a/rowers/tests/testdata/testdata.tcx.gz and b/rowers/tests/testdata/testdata.tcx.gz differ