fastai / fastprogress

Simple and flexible progress bar for Jupyter Notebook and console
Apache License 2.0
1.08k stars 105 forks source link

Fix for systems which clear a line after printing '\r' sign #40

Closed jachoo closed 4 years ago

jachoo commented 4 years ago

Some terminals (like PyCharm Console) clear whole line if \r sign is printed. As fastprogress almost always prints \r at the end of line, nothing is displayed in such terminals.

This pull request adds a workaround for this bug and sets line ending to empty string if requested by the user. Moreover, it forces print function to flush the output. Usage:

import fastprogress
fastprogress.workaround_empty_console_output()
sgugger commented 4 years ago

Thanks!