Skip to content

0-length files never finish #72

Description

@kousu

A progressbar with maxval=0 doesn't fill its bars on .finish(). I know it's not mathematically sound (0/0 is undefined, not 100%) but I think it should. It means that when I'm uploading 0-length files they stick out weirdly in the log.

$ cat t.py
import sys
from progressbar import *
widgets = [f'fname: ', Percentage(), ' ', Bar(marker=RotatingMarker()),
                           ' ', ETA(), ' ', FileTransferSpeed()]
pbar = ProgressBar(widgets=widgets, maxval=int(sys.argv[1])) 
pbar.start()
pbar.finish()
$ python t.py 0
fname: 100% |                                                                                                             | ETA:  --:--:--   0.00  B/s
$ python t.py 1
fname: 100% |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| Time: 0:00:00   1.52 kB/s
$ python t.py 100
fname: 100% |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| Time: 0:00:00 153.08 kB/s

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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