NiltonVolpato / python-progressbar

Text progress bar library for Python
Other
412 stars 105 forks source link

ZeroDvisionError #14

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I'm getting a ZeroDivisionError from line 208 in progressbar/__init__.py. This 
happens in 2.3, possibly because I'm trying to set the progress to 0. 

Original issue reported on code.google.com by bjou...@gmail.com on 15 Jul 2011 at 10:24

GoogleCodeExporter commented 8 years ago
Can you post a piece of code that reproduces the problem?

I think you're probably setting the maxval to zero or using it with a sequence 
with size zero.

Original comment by nilton.v...@gmail.com on 15 Jul 2011 at 11:40

GoogleCodeExporter commented 8 years ago
Yeah that's likely the case because maxval is set algorithmically. However, it 
is easy for progressbar to avoid dividing by zero.

Original comment by bjou...@gmail.com on 16 Jul 2011 at 6:14

GoogleCodeExporter commented 8 years ago
This patch fixes a problem in the Bar widget where it will divide by zero if 
its maxval is 0.

Original comment by amch...@gmail.com on 24 Oct 2011 at 10:11

Attachments:

GoogleCodeExporter commented 8 years ago
I'm applying a similar fix. Thanks for the patch.

Original comment by nilton.v...@gmail.com on 25 Oct 2011 at 8:01

GoogleCodeExporter commented 8 years ago
Done in 
http://code.google.com/p/python-progressbar/source/detail?r=e2db1f229a9cfca6bc60
87f10c307d1668b8c709

Original comment by nilton.v...@gmail.com on 25 Oct 2011 at 8:03