mirror of
https://github.com/kennethreitz/crayons.git
synced 2026-06-05 23:10:18 +00:00
Add hasattr check for isatty on sys.stdout (#27)
* Add hasattr check for isatty on sys.stdout * fix flake8 error Signed-off-by: Matthew Peveler <matt.peveler@gmail.com>
This commit is contained in:
+3
-1
@@ -80,7 +80,9 @@ class ColoredString(object):
|
||||
|
||||
if self.always_color:
|
||||
return c
|
||||
elif sys.stdout.isatty() and not DISABLE_COLOR:
|
||||
elif hasattr(sys.stdout, 'isatty') \
|
||||
and sys.stdout.isatty() \
|
||||
and not DISABLE_COLOR:
|
||||
return c
|
||||
else:
|
||||
return self.s
|
||||
|
||||
Reference in New Issue
Block a user