Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix issue http://code.google.com/p/python-progressbar/issues/detail?i…

  • Loading branch information...
commit f07162333c678401ff9ee1af0427b2e24897a9a6 1 parent 44073e9
Nilton Volpato authored
Showing with 8 additions and 5 deletions.
  1. +8 −5 progressbar/widgets.py
View
13 progressbar/widgets.py
@@ -253,17 +253,20 @@ def __init__(self, marker='#', left='|', right='|', fill=' ',
def update(self, pbar, width):
'Updates the progress bar and its subcomponents'
- left, marker, right = (format_updatable(i, pbar) for i in
+ left, marked, right = (format_updatable(i, pbar) for i in
(self.left, self.marker, self.right))
width -= len(left) + len(right)
- # Marker must *always* have length of 1
- marker *= int(pbar.currval / pbar.maxval * width)
+ # Marked must *always* have length of 1
+ if pbar.maxval:
+ marked *= int(pbar.currval / pbar.maxval * width)
+ else:
+ marked = ''
if self.fill_left:
- return '%s%s%s' % (left, marker.ljust(width, self.fill), right)
+ return '%s%s%s' % (left, marked.ljust(width, self.fill), right)
else:
- return '%s%s%s' % (left, marker.rjust(width, self.fill), right)
+ return '%s%s%s' % (left, marked.rjust(width, self.fill), right)
class ReverseBar(Bar):
Please sign in to comment.
Something went wrong with that request. Please try again.