mirror of https://github.com/tqdm/tqdm.git
minor bugfix to handle virtual environments and streams without `flush` attribute
This commit is contained in:
parent
7aeb45a2ea
commit
da91bb23ba
|
@ -177,6 +177,9 @@ def StatusPrinter(file):
|
|||
may not work (it will print a new line at each refresh).
|
||||
"""
|
||||
fp = file
|
||||
if not getattr(fp, 'flush', False): # pragma: no cover
|
||||
fp.flush = lambda: None
|
||||
|
||||
last_printed_len = [0] # closure over mutable variable (fast)
|
||||
|
||||
def print_status(s):
|
||||
|
|
Loading…
Reference in New Issue