Skip to content

progressbar doesn't reach 100% #102

@gerritholl

Description

@gerritholl

Description

When updated quickly, progressbar doesn't reach 100%. This is a consequence of this commit. In particular, the final update should be treated differently because the output for this one remains. In the example below, progressbar decides not to bother printing the 100% so that for the user, there is the impression the process got stuck at 94% and never finished...

Code

#!/usr/bin/env python
import progressbar
import time
print("progressbar version", progressbar.__version__)
bar = progressbar.ProgressBar(max_value=1,
    widgets=[progressbar.Bar("=", "[", "]"),
    " ", progressbar.Percentage(),
    ' (', progressbar.ETA(), ') '])
bar.start()
for i in range(95):
    time.sleep(0.01)
    bar.update(i/100)

bar.update(1)
bar.finish()

Result:

$ ./mwe.py 
progressbar version 3.15.0
[====================================================    ]  94% (ETA: 0:00:00) 

Versions

  • Python version: 3.5.0
  • Python distribution/environment: CPython
  • Operating System: Red Hat Enterprise Linux Server release 6.8 (Santiago)
  • Package version: through git bisect, I learn that 2c92204 is the first bad commit

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions