Skip to content

Unwanted characters printing after bar.finish() #101

@AldoMaine

Description

@AldoMaine

Windows 10, Python 3.9.7

Running this code:

`import random
import time
from progress.bar import Bar

def sleep():
t = 0.01
t += t * random.uniform(-0.1, 0.1) # Add some variance
time.sleep(t)

bar = Bar('Processing')
for i in bar.iter(range(200, 400)):
sleep()
bar.finish()`

Yields this in the console:
Processing |################################| 200/200
�[?25h

The last line is the unexpected output.

Investigation:
When finish() runs, it prints '\x1b[?25h' if hidden_cursor is True. On my system that results in the unwanted characters shown above. Probably a Windows thing?

Workaround: add bar._hidden_cursor = False before bar.finish()

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