-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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] Leftover newlines with progress after using remove_task. #3397
Labels
Comments
A simple way to avoid this would be to move the from rich.progress import Progress
import asyncio
async def meow(progress_bar):
task = progress_bar.add_task("Meowing...", total=10)
meows = 0
meow_total = 3
meow_increase = 1
while meows < meow_total:
progress_bar.update(task, advance=meow_total / meow_increase)
meows += meow_increase
await asyncio.sleep(1)
progress_bar.remove_task(task)
progress = Progress(transient=True)
with progress as progress_bar:
while True:
asyncio.run(meow(progress_bar)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
Hi,
I'm using asyncio where two independent functions might add a progress bar at any time and they will progress independently.
Because of this, I can't use Progress in a context manager such that it destroys the object when the progress is done, instead I am initialising the object and passing it through to both functions at their initialisation.
I didn't want any leftover progress bars to remain, so I delete them on completion by calling remove_task.
I then ran into this problem, while the task is removed, either the space it occupied remains, or add_task automatically attempts to compensate for another progress bar that it thinks exists above it, and adds a newline.
The result is the same, as time goes on the progress bars descend further and further down, I've recorded a gif to demonstrate:
I've also put together the minimal code to recreate this:
Platform
Click to expand
What platform (Win/Linux/Mac) are you running on? What terminal software are you using?
Ubuntu 22.04, Gnome Terminal and the VSCodium / VSCode terminal.
If you're using Rich in a terminal:
The text was updated successfully, but these errors were encountered: