Skip to content

[BUG] Blank line is printed when backend=False #104

@npt

Description

@npt

Describe the bug

When backend=False, a blank line is still printed to the console.

This seems to be caused by the fp.write('\n') in tqdm.close(). (if leave=False, it prints \r instead)

I've worked around this by passing a handle to os.devnull as file=. I'm not sure what the best way to work around in stqdm itself would be. It seems like a bug in tqdm that it always prints this if display is never called.

To Reproduce

streamlit run this:

import time
import stqdm

print("before")
for _ in stqdm.stqdm(range(2), backend=False):
    time.sleep(0.5)
print("after")

Prints:

before

after

Expected behavior

When backend=False, nothing is printed at all. (The above example would have no blank line between before and after.)

Desktop (please complete the following information):

  • OS: Linux
  • Browser: firefox
  • Version of streamlit: 1.41.1
  • Version of stqdm: 0.0.5
  • Version of tqdm: 4.67.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions