From e0c55a8ae132bedef5da27ecbbb9489a094d454c Mon Sep 17 00:00:00 2001 From: Dale Wahl Date: Thu, 30 May 2024 12:51:42 +0200 Subject: [PATCH] download_images fix divide by zero when user can download all --- processors/visualisation/download_images.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/processors/visualisation/download_images.py b/processors/visualisation/download_images.py index e325ec1dd..ebed681f4 100644 --- a/processors/visualisation/download_images.py +++ b/processors/visualisation/download_images.py @@ -263,6 +263,7 @@ def process(self): downloaded_images = 0 processed_urls = 0 failures = [] + total_images = len(urls) if amount == 0 else amount for url in urls: if amount != 0 and downloaded_images >= amount: break @@ -273,8 +274,8 @@ def process(self): processed_urls += 1 self.dataset.update_status("Downloaded %i/%i images; downloading from %s" % - (downloaded_images, amount, url)) - self.dataset.update_progress(downloaded_images / amount) + (downloaded_images, total_images, url)) + self.dataset.update_progress(downloaded_images / total_images) try: # acquire image