From e7b2296902c9c348bea9d3956b76bde39fbf4ab1 Mon Sep 17 00:00:00 2001 From: Pete Bunting Date: Thu, 13 Jun 2024 13:30:23 +0100 Subject: [PATCH] Fix for rios v2.0 in how the progress bar is called. --- python/rsgislib/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/python/rsgislib/__init__.py b/python/rsgislib/__init__.py index 779838fc..9027358b 100644 --- a/python/rsgislib/__init__.py +++ b/python/rsgislib/__init__.py @@ -698,6 +698,7 @@ class TQDMProgressBar: def __init__(self): self.lprogress = 0 + self.pbar = None def setTotalSteps(self, steps: int): import tqdm @@ -711,13 +712,16 @@ def setTotalSteps(self, steps: int): self.lprogress = 0 def setProgress(self, progress: int): + if self.pbar is None: + self.setTotalSteps(steps=100) step = progress - self.lprogress self.pbar.update(step) self.lprogress = progress def reset(self): - self.pbar.close() import tqdm + if self.pbar is not None: + self.pbar.close() if is_notebook(): import tqdm.notebook