diff --git a/weboob/tools/application/console.py b/weboob/tools/application/console.py index b8e756bd..c2dde03a 100644 --- a/weboob/tools/application/console.py +++ b/weboob/tools/application/console.py @@ -63,7 +63,9 @@ class ConsoleApplication(BaseApplication): CAPS = None # shell escape strings - if sys.platform == 'win32' or not os.isatty(sys.stdout.fileno()): + if sys.platform == 'win32' \ + or not os.isatty(sys.stdout.fileno()) \ + or os.getenv('ANSI_COLORS_DISABLED') is not None: #workaround to disable bold BOLD = '' NC = '' # no color diff --git a/weboob/tools/application/formatters/iformatter.py b/weboob/tools/application/formatters/iformatter.py index 2eba0a2f..8c0f75de 100644 --- a/weboob/tools/application/formatters/iformatter.py +++ b/weboob/tools/application/formatters/iformatter.py @@ -28,7 +28,8 @@ try: from termcolor import colored except ImportError: def colored(s, color=None, on_color=None, attrs=None): - if attrs is not None and 'bold' in attrs: + if os.getenv('ANSI_COLORS_DISABLED') is None \ + and attrs is not None and 'bold' in attrs: return '%s%s%s' % (IFormatter.BOLD, s, IFormatter.NC) else: return s