verigak / progress

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

avoid division by 0 #72

Closed flokno closed 4 years ago

flokno commented 5 years ago

This fixes an issue that arises when an empty list is passed to the iter() method.

Currently, the following example raises a ZeroDivisionError:

from progress.bar import Bar

it = []

bar = Bar("test")
for elem in bar.iter(it):
    pass
verigak commented 4 years ago

I'm sorry I missed your PR and merged a later identical one. Thank you nevertheless.