Tqdm: pbar.set_description does not respect `mininterval`, `miniters`

Created on 27 Feb 2018  ·  4Comments  ·  Source: tqdm/tqdm

tqdm version 4.19.5, python 3.5, ubuntu 16.04

tqdm update doesn't respect mininterval or miniters. For example, if I set mininterval = 10 but update every second, the progress bar data will be updated more than every 10s.

While this is not a problem for normal usage, I am interested in passing tqdm into logging. I update the description every inner loop, which causes huge logs.

duplicate 🗐 invalid ⛔ questiodocs ‽

Most helpful comment

You need set_*(..., refresh=False) as stated in the function's help.

All 4 comments

Could you provide a basic example? This works as expected for me:

from tqdm import tqdm

with tqdm(total=12345678, mininterval=10) as t:
    for i in range(12345678):
        t.update()

Sorry, I meant set_description

from tqdm import tqdm

with tqdm(total=12345678, mininterval=500) as t:
    for i in range(12345678):
        t.set_description('%d' % (i * 3))

set_postfix also seems to not respect miniters or mininterval and immediately refreshes the bar, which is problematic whenever we are adding any other metadata to the progress bar.

You need set_*(..., refresh=False) as stated in the function's help.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

techkang picture techkang  ·  4Comments

lrq3000 picture lrq3000  ·  5Comments

demiangomez picture demiangomez  ·  4Comments

Haffi112 picture Haffi112  ·  5Comments

jlumpe picture jlumpe  ·  5Comments