From e1bdaa4d0d99fc6b53841bc0f075286351d60eb8 Mon Sep 17 00:00:00 2001 From: Jack Riches Date: Tue, 14 Aug 2012 09:47:34 +0100 Subject: [PATCH] More robust checking for if output is a tty --- clint/textui/progress.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/clint/textui/progress.py b/clint/textui/progress.py index ad97733..1a110c9 100644 --- a/clint/textui/progress.py +++ b/clint/textui/progress.py @@ -15,7 +15,10 @@ import time STREAM = sys.stderr # Only show bar in terminals by default (better for piping, logging etc.) -HIDE_DEFAULT = False if STREAM.isatty() else True +try: + HIDE_DEFAULT = not STREAM.isatty() +except AttributeError: # output does not support isatty() + HIDE_DEFAULT = True BAR_TEMPLATE = '%s[%s%s] %i/%i - %s\r' MILL_TEMPLATE = '%s %s %i/%i\r'