tqdm + logging, message containing line feed gets eaten after line feed #724
Labels
duplicate 🗐
Seen it before
p2-bug-warning ⚠
Visual output bad
p4-enhancement-future 🧨
On the back burner
question/docs ‽
Documentation clarification candidate
to-fix ⌛
In progress
Milestone
tqdm v. 4.31.1
Python v. 3.7.0
Linux version : Debian stretch (this bug does not reproduce on MacOs or ArchLinux)
When using tqdm with logging, configured as @casperdcl suggests it in #313 BUT with a line feed in the message, tqdm eats the new line.
Test code:
Now, several test cases:
\n
is added to the end of the message, the text now gets displayed properly (with the line feed at the end, but we asked for it)end="\n"
instead ofend=""
, the message gets displayed properly but with two line feeds at the end.end="test"
shows that tqdm seems to have an issue with stdout buffering, since it appends "test" to the next logging line (probably an issue on itself, not sure how it's related to this issue)One might think that this is a flushing issue, but adding the following solves the 3rd test case (while breaking the progress bar though), while doing nothing for the 2nd one (not even breaking the progress bar).
The text was updated successfully, but these errors were encountered: