Skip to content

update(n=0) causes ZeroDivisionError if it is the first update #268

@ferrouswheel

Description

@ferrouswheel

v4.8.4

Traceback (most recent call last):
  File "x.py", line 273, in train
    bar.update(0)
  File "C:\Python27\lib\site-packages\tqdm\_tqdm.py", line 808, in update
    if self.avg_time is None \
ZeroDivisionError: float division by zero

If one is manually updating a progress bar, and for some reason your code can output a step size of 0 (while smoothing the time estimate), then a ZeroDivisionError occurs.

This only happens if update(n=0) is the first call. If you have previously called update with a non-zero number, then subsequent updates with n==0 are fine.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions