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] rich.print() during rich.progress causes duplicate progress bars #1052

Closed
The-Compiler opened this issue Feb 24, 2021 · 4 comments
Closed
Labels
bug Something isn't working

Comments

@The-Compiler
Copy link
Contributor

The-Compiler commented Feb 24, 2021

Describe the bug
When using rich.print('foo') during rich.progress, the text gets displayed above the progress pars, as expected:

foo
foo
foo
foo
foo
Working... ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:00

When doing the same with rich.print(''), it works as expected too:






Working... ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:00

However, when doing rich.print() without any arguments, the progress bar gets repainted:

Working... ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━   0% -:--:--
Working... ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━   0% -:--:--
Working... ━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━  20% -:--:--
Working... ━━━━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━━━━━━━━━  40% 0:00:02
Working... ━━━━━━━━━━━━━━━━━━━━━━━━╺━━━━━━━━━━━━━━━  60% 0:00:02
Working... ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 0:00:00

or with some more colors:

image

To Reproduce

Run this:

import time
import rich
import rich.progress

for n in rich.progress.track(range(5)):
    # rich.print('foo')
    # rich.print('')
    rich.print()
    time.sleep(0.5)

Platform
What platform (Win/Linux/Mac) are you running on? What terminal software are you using?

Arch Linux with Kitty

Diagnose
I may ask you to cut and paste the output of the following commands. It may save some time if you do it now.

python -m rich.diagnose
python -m rich._windows
pip freeze | grep rich
╭────────────────────── <class 'rich.console.Console'> ───────────────────────╮
│ A high level console interface.                                             │
│                                                                             │
│ ╭─────────────────────────────────────────────────────────────────────────╮ │
│ │ <console width=79 ColorSystem.TRUECOLOR>                                │ │
│ ╰─────────────────────────────────────────────────────────────────────────╯ │
│                                                                             │
│     color_system = 'truecolor'                                              │
│         encoding = 'utf-8'                                                  │
│             file = <_io.TextIOWrapper name='<stdout>' mode='w'              │
│                    encoding='utf-8'>                                        │
│           height = 16                                                       │
│ is_dumb_terminal = False                                                    │
│   is_interactive = True                                                     │
│       is_jupyter = False                                                    │
│      is_terminal = True                                                     │
│   legacy_windows = False                                                    │
│         no_color = False                                                    │
│          options = ConsoleOptions(size=ConsoleDimensions(width=79,          │
│                    height=16), legacy_windows=False, min_width=1,           │
│                    max_width=79, is_terminal=True, encoding='utf-8',        │
│                    justify=None, overflow=None, no_wrap=False,              │
│                    highlight=None, height=None)                             │
│            quiet = False                                                    │
│           record = False                                                    │
│         safe_box = True                                                     │
│             size = ConsoleDimensions(width=79, height=16)                   │
│        soft_wrap = False                                                    │
│           stderr = False                                                    │
│            style = None                                                     │
│         tab_size = 8                                                        │
│            width = 79                                                       │
╰─────────────────────────────────────────────────────────────────────────────╯
platform="Linux"
WindowsConsoleFeatures(vt=False, truecolor=False)
rich @ git+https://github.com/willmcgugan/rich.git@1c1d72ccad965a41500253680c73e6606924cd13

(current git master; but also with 9.11.1)

@willmcgugan willmcgugan added bug Something isn't working and removed Needs triage labels Feb 24, 2021
@willmcgugan
Copy link
Collaborator

Yep, confirmed. Fix soon. In the meantime, console.print('\n') will probably work.

@willmcgugan
Copy link
Collaborator

Please try 9.12.0

@willmcgugan
Copy link
Collaborator

Should be fix. Reopen if you still have problems.

@The-Compiler
Copy link
Contributor Author

Apologies for the radio silence - indeed things look great after upgrading to 9.12.3! Thanks for the quick fix! 🎉

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

2 participants