From 7aeb45a2eacc4857a3bbcf380072aa41e7a4bf55 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Fri, 6 Nov 2015 18:46:44 +0000 Subject: [PATCH 1/2] minor ncols bugfix for certain windows environments --- tqdm/_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 tqdm/_utils.py diff --git a/tqdm/_utils.py b/tqdm/_utils.py old mode 100644 new mode 100755 index cad222e1..8116cf1c --- a/tqdm/_utils.py +++ b/tqdm/_utils.py @@ -58,7 +58,7 @@ def _environ_cols_windows(fp): # pragma: no cover (bufx, bufy, curx, cury, wattr, left, top, right, bottom, maxx, maxy) = struct.unpack("hhhhHhhhhhh", csbi.raw) # nlines = bottom - top + 1 - return right - left + 1 + return right - left # +1 except: pass return None From da91bb23ba91fd104ca67a52c7a77e8d9765210e Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Thu, 5 Nov 2015 14:39:57 +0000 Subject: [PATCH 2/2] minor bugfix to handle virtual environments and streams without `flush` attribute --- tqdm/_tqdm.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tqdm/_tqdm.py b/tqdm/_tqdm.py index e6f72277..c37986f5 100644 --- a/tqdm/_tqdm.py +++ b/tqdm/_tqdm.py @@ -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):