Skip to content

tqdm.write(string) doesn't work well when string has \n in it #564

@half1red

Description

@half1red

Hi,
I'am using tqdm 4.23.4 on python 3.6.3.

I noticed what I think might be an issue when I use tqdm.write with a multiline string.
The two snippets below don't work the same way (the correct behavior I think is the second one) :

from time import sleep
from tqdm import tqdm, trange

def test():
    for x in tqdm(range(30)):
        sleep(0.05)
        
for x in trange(10):
    tqdm.write("\ntest " + str(x))
    test()
from time import sleep
from tqdm import tqdm, trange

def test():
    for x in tqdm(range(30)):
        sleep(0.05)
        
for x in trange(10):
    tqdm.write("")
    tqdm.write("test " + str(x))
    test()

Also, but that may be an other issue, I haven't find a way to have nested progress bars with print between bar that would remain plotted (and not print above all the bars).

Metadata

Metadata

Assignees

Labels

question/docs ‽Documentation clarification candidate

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions