NiltonVolpato / python-progressbar

Text progress bar library for Python
Other
412 stars 105 forks source link

Cannot convert Float to Integer Error #64

Open mugoh opened 5 years ago

mugoh commented 5 years ago

The progressbar gives the following error on call

File "/usr/local/lib/python3.7/dist-packages/progressbar/widgets.py", line 230, in update
    return '%3d%%' % pbar.percentage()
ValueError: cannot convert float NaN to integer

This is how the bar the bar widgets have been created:

progress_bar_widgets = [
    'Training: ', progressbar.Percentage(),
    ' ',
    progressbar.Bar(marker='#',
                    left='[',
                    right=']'
                    ),
    ' ',
    progressbar.ETA(), ' '
]

Replacing line 230 in error the traceback to format the print for floats seems to suppress the problem. Thanks.

NiltonVolpato commented 5 years ago

I think this was fixed already in this commmit: https://github.com/niltonvolpato/python-progressbar/commit/b2c5bc088fd4f83276f37fd8f1a2d37727cf9fd3