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

set_description_str() no longer drops colon #1616

Open
5 of 6 tasks
namaenonaimumei opened this issue Sep 26, 2024 · 1 comment
Open
5 of 6 tasks

set_description_str() no longer drops colon #1616

namaenonaimumei opened this issue Sep 26, 2024 · 1 comment

Comments

@namaenonaimumei
Copy link

  • I have marked all applicable categories:
    • exception-raising bug
    • visual output bug
  • I have visited the [source website], and in particular
    read the [known issues]
  • I have searched through the [issue tracker] for duplicates
  • I have mentioned version numbers, operating system and
    environment, where applicable:
    4.66.5 3.12.3 (main, Apr 23 2024, 09:16:07) [GCC 13.2.1 20240417] linux
    

As per title there is no longer output difference between set_description() and set_description_str() and only way to remove : is directly through updating bar_format.

from tqdm import tqdm
import requests

url = "url"
response = requests.get(url, stream=True)
description = "text"

with open(f"out.bin", "wb") as handle:
    # Works as expected
    progress_bar = tqdm(total=int(response.headers.get("content-length", "0")), unit="iB", unit_scale=True, position=None, bar_format=description + "{percentage:3.0f}%|{bar}{r_bar}")

    # No longer removes colon
    progress_bar = tqdm(total=int(response.headers.get("content-length", "0")), unit="iB", unit_scale=True, position=None)
    progress_bar.set_description_str(description)

    for data in response.iter_content(chunk_size=64 * 1024):
        progress_bar.update(len(data))
        handle.write(data)

This has been broken for a while now, did some api change, as documentation still mentions using set_description_str() instead?

@evalott100
Copy link

Was about to submit this myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants