minor bugfix to handle virtual environments and streams without `flush` attribute

This commit is contained in:
Casper da Costa-Luis 2015-11-05 14:39:57 +00:00
parent 7aeb45a2ea
commit da91bb23ba
1 changed files with 3 additions and 0 deletions

View File

@ -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):