You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Using ProgressBar as iterator from empty iterable causes traceback #36
progressbar==2.3
Ubuntu 13.04
So this works:
for n in progressbar.ProgressBar()([1]):
print n
It will print 1 and all the progress information as expected.
But
for n in progressbar.ProgressBar()([]):
print n
gives traceback as follows:
AttributeError Traceback (most recent call last)
<ipython-input-4-bf738fc09ad4> in <module>()
----> 1 for n in progressbar.ProgressBar()([]):
2 print n
3
/home/tcorbettclark/.virtualenvs/ice/local/lib/python2.7/site-packages/progressb
ar/__init__.pyc in __next__(self)
182 return value
183 except StopIteration:
--> 184 self.finish()
185 raise
186
/home/tcorbettclark/.virtualenvs/ice/local/lib/python2.7/site-packages/progressb
ar/__init__.pyc in finish(self)
318
319 self.finished = True
--> 320 self.update(self.maxval)
321 self.fd.write('\n')
322 if self.signal_set:
/home/tcorbettclark/.virtualenvs/ice/local/lib/python2.7/site-packages/progressb
ar/__init__.pyc in update(self, value)
274
275
--> 276 if not self._need_update(): return
277 if self.start_time is None:
278 raise RuntimeError('You must call "start" before calling "update"')
/home/tcorbettclark/.virtualenvs/ice/local/lib/python2.7/site-packages/progressb
ar/__init__.pyc in _need_update(self)
249 def _need_update(self):
250 'Returns whether the ProgressBar should redraw the line.'
--> 251 if self.currval >= self.next_update or self.finished: return
True
252
253 delta = time.time() - self.last_update_time
AttributeError: next_update
Original issue reported on code.google.com by timothy....@gmail.com on 13 Apr 2014 at 11:41
Activity
frost-nzcr4 commentedon Jan 27, 2016
Run
start()manually to initiate thenext_updateproperty: