diff --git a/NDATools/Download.py b/NDATools/Download.py index 4804db3..6fb8e0a 100644 --- a/NDATools/Download.py +++ b/NDATools/Download.py @@ -358,8 +358,9 @@ def download(file_id_to_cred_list): # dont generate a file if there were no failures if not self.package_file_download_errors: - logger.info('No failures detected. Removing file {}'.format(failed_s3_links_file.name)) - os.remove(failed_s3_links_file.name) + if os.path.exists(failed_s3_links_file.name): + logger.info('No failures detected. Removing file {}'.format(failed_s3_links_file.name)) + os.remove(failed_s3_links_file.name) logger.info('') @@ -1058,4 +1059,4 @@ def get_completed_files_in_download(self): with open(download_progress_report_path, newline='') as csvfile: file_reader = csv.DictReader(csvfile) files = [f for f in file_reader if bool(f['exists'])] - return files \ No newline at end of file + return files