minhajshaik / python-progressbar

Automatically exported from code.google.com/p/python-progressbar
Other
0 stars 0 forks source link

ProgressBar.__call__ always calls __len__ even when maxval is already specified #10

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
ProgressBar.__call__ also only expects TypeError to be raised as a result of 
calling __len__, when in fact other errors are seen to be raised (e.g. on a 
csv.DictReader this raises an AttributeError). But in general it would be nice 
if there were a (non-hacky) way to force a maxval onto a ProgressBar, 
regardless of the iteratee's len.

Original issue reported on code.google.com by yaa...@gmail.com on 10 May 2011 at 4:35

GoogleCodeExporter commented 9 years ago
Check out 
http://code.google.com/r/terencehonles-python-progressbar/source/detail?r=291481
0af9066eb47da0a1c2df81c43050efa64f

I cloned the repo and ended up making some improvements which address your 
comment

Original comment by Terence....@gmail.com on 15 May 2011 at 9:03

GoogleCodeExporter commented 9 years ago
The changes have been merged, and although it will *try* to determine the 
length of the iterable it will fall back to the max value you specified or if 
unspecified it will be marked as "unknown" (this means that you must use 
widgets which do not need to know the max length: timers, counters, labels, 
action bars, etc)

Original comment by Terence....@gmail.com on 16 May 2011 at 3:28