diff --git a/src/tools/common/ansi.py b/src/tools/common/ansi.py index a66accd3..5c7788b7 100644 --- a/src/tools/common/ansi.py +++ b/src/tools/common/ansi.py @@ -42,8 +42,13 @@ class ANSI(object): return u''.join(args) -if not sys.stdout.isatty(): +try: + tty = sys.stdout.isatty() +except AttributeError: + tty = False +if not tty: # we don't want ANSI escape codes if we are not outputing to a tty! for attr in dir(ANSI): if isinstance(getattr(ANSI, attr), basestring): setattr(ANSI, attr, u'') +del tty