From 57a36d49f266143cceb757b9c342086e8c752117 Mon Sep 17 00:00:00 2001 From: Edward Barak Date: Thu, 28 Mar 2019 09:37:07 -0400 Subject: [PATCH] Add help message to check_tty AttributeError --- progress/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/progress/__init__.py b/progress/__init__.py index e434c25..cf81933 100644 --- a/progress/__init__.py +++ b/progress/__init__.py @@ -109,7 +109,10 @@ class Infinite(object): print(SHOW_CURSOR, end='', file=self.file) def is_tty(self): - return self.file.isatty() if self.check_tty else True + try: + return self.file.isatty() if self.check_tty else True + except AttributeError: + raise AttributeError('\'{}\' object has no attribute \'isatty\'. Try setting parameter check_tty=False.'.format(self)) def next(self, n=1): now = monotonic()