Skip to content

print statements between progress bars begin at the end of the progress bar line #162

@jasonslay

Description

@jasonslay

Description

When using redirect_stdout=True, printing between progress bars begins printing at the end of the line the progress bar was on. In the example below the 'halftime' appears on the end of the line from the first progress bar (and is forced to wrap after the first character). I would expect it to start on a new line. Is this not the case?

Code

import time
import progressbar

for ix in progressbar.progressbar(range(5), redirect_stdout=True):
    print('first', ix)
    time.sleep(0.02)

print('halftime')

for ix in progressbar.progressbar(range(5), redirect_stdout=True):
    print('second', ix)
    time.sleep(0.02)

Output

first 0
first 1
first 2
first 3
first 4
100% (5 of 5) |#################| Elapsed Time: 0:00:00 Time:  0:00:00halftime
second 0
second 1
second 2
second 3
second 4
100% (5 of 5) |#################| Elapsed Time: 0:00:00 Time:  0:00:00

Versions

  • Python version: 3.6.5 (default, Mar 30 2018, 06:41:53)
  • Python distribution/environment: CPython
  • Operating System: MacOS 10.13.4
  • Package version: 3.37.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions