Skip to content

progressbar does not allow update of 0 #447

@nchammas

Description

@nchammas
with click.progressbar(length=5) as progress_bar:
    progress_bar.update(0)

This throws a float division by zero error, which I believe is caused by this line here.

The reason I ran into this is because I'm trying to use progressbar to track the status of remote resources which do work at unpredictable intervals. I pass in something like work_remaining_start - work_remaining_end to progress_bar.update() in a loop that periodically checks these remote resources, and sometimes this difference is 0.

Does it make sense for update() to accept a step of 0?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions