From abf7b1175846bb36936e5d2b46e309ab89c0cc50 Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Thu, 17 Oct 2019 13:18:33 -0300 Subject: [PATCH] [http] improvement -> removing old output path before downloading --- bauh/view/core/downloader.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bauh/view/core/downloader.py b/bauh/view/core/downloader.py index acdf5c44..ffad3c0b 100644 --- a/bauh/view/core/downloader.py +++ b/bauh/view/core/downloader.py @@ -74,6 +74,11 @@ class AdaptableFileDownloader(FileDownloader): success = False ti = time.time() try: + if os.path.exists(output_path): + self.logger.info('Removing old file found before downloading: {}'.format(output_path)) + os.remove(output_path) + self.logger.info("Old file {} removed".format(output_path)) + if self.is_multithreaded(): ti = time.time() process = self._get_aria2c_process(file_url, output_path, final_cwd)