Skip to content

[BUG] rich.print() during rich.progress causes duplicate progress bars #1052

@The-Compiler

Description

@The-Compiler

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions