diff --git a/catalyst/exchange/utils/exchange_utils.py b/catalyst/exchange/utils/exchange_utils.py index 5c40a26d..658a7002 100644 --- a/catalyst/exchange/utils/exchange_utils.py +++ b/catalyst/exchange/utils/exchange_utils.py @@ -446,12 +446,13 @@ def remove_old_files(algo_name, today, rel_path, environ=None): # run on all files in the folder for f in os.listdir(folder): try: - creation_unix = os.path.getctime(os.path.join(folder, f)) - creation_time = pd.to_datetime(creation_unix, unit='s', ) + file_path = os.path.join(folder, f) + creation_unix = os.path.getctime(file_path) + creation_time = pd.to_datetime(creation_unix, unit='s', utc=True) # if the file is older than 30 days erase it if today - pd.DateOffset(30) > creation_time: - os.unlink(f) + os.unlink(file_path) except OSError: error = 'unable to erase files in {}'.format(folder)