Skip to content

Bar is not drawn on Python 3 if .write() is used too soon #348

@hynek

Description

@hynek

Consider the following program:

import time

from tqdm import tqdm

with tqdm(range(5)) as bar:
    for i in bar:
        bar.write(str(i))
        time.sleep(1)

On Python 2.7, it does exactly what you’d expect.

On Python 3 (at least 3.5 and 3.6), the bar is not drawn until it’s closed.

If you move the bar.write() behind the time.sleep(1), it works on Python 3 too.

Some kind of race condition?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions