diff --git a/rowers/dataroutines.py b/rowers/dataroutines.py index 43807ca9..ad946f8e 100644 --- a/rowers/dataroutines.py +++ b/rowers/dataroutines.py @@ -1864,7 +1864,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 99ab4353..857e844c 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',