Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
npt opened this issue Jan 10, 2025 · 0 comments
Open

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

npt opened this issue Jan 10, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@npt
Copy link

npt commented Jan 10, 2025

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant