add error handling and script runs until unexpected error or max reached
This commit is contained in:
@@ -11,8 +11,15 @@ class Progress:
|
||||
self.current = current
|
||||
progress = current / self.total
|
||||
bar_length = 40
|
||||
progress_bar = "[" + "=" * int(bar_length * progress) + \
|
||||
"-" * (bar_length - int(bar_length * progress)) + "]"
|
||||
progress_bar = (
|
||||
"["
|
||||
+ "=" * int(bar_length * progress)
|
||||
+ "-" * (bar_length - int(bar_length * progress))
|
||||
+ "]"
|
||||
)
|
||||
sys.stdout.write(
|
||||
"\rProgress: [{:<40}] {:.2%} {} of {}".format(progress_bar, progress, current, self.total))
|
||||
"\rProgress: [{:<40}] {:.2%} {} of {}".format(
|
||||
progress_bar, progress, current, self.total
|
||||
)
|
||||
)
|
||||
sys.stdout.flush()
|
||||
|
||||
Reference in New Issue
Block a user