verigak / progress

Easy to use progress bars for Python
ISC License
1.41k stars 179 forks source link

ZeroDivision error when max=0 #70

Closed gabriele-cannizzaro closed 5 years ago

gabriele-cannizzaro commented 5 years ago

When "max" is set to zero (can happen if there's nothing to process) the code returns a ZeroDivision error when update() is called.

The culprit seems to be in progress/__init__.py, like 156:

@property
def progress(self):
    return min(1, self.index / self.max)
gabriele-cannizzaro commented 5 years ago

I see there's already a fix in PR #72, closing this one.