fastai / fastprogress

Simple and flexible progress bar for Jupyter Notebook and console
Apache License 2.0
1.09k stars 106 forks source link

ZeroDivisionError for `progress_bar` in Console for empty iterables #38

Closed nvs-abhilash closed 5 years ago

nvs-abhilash commented 5 years ago

Progress Bar is failing for empty iterables in console.

It works fine in notebook: image

But in Console it doesn't work: image

Code snippet used:

import fastprogress
from fastprogress import progress_bar, master_bar
fastprogress.__version__

# I have a variable length list, which can also be empty

variable_len_list = [] # special case of empty lisy

for x in variable_len_list:
    # do some compute
    sleep(10)

for x in master_bar(variable_len_list):
    # do some compute
    sleep(10)

for x in progress_bar(variable_len_list):
    # do some compute
    sleep(10)
nvs-abhilash commented 5 years ago

The issue seemed to be fixed in the master branch. I installed the library as below, and it is working fine now: pip install git+https://github.com/fastai/fastprogress.git --upgrade