From: Ben Darnell Date: Sat, 26 Oct 2013 22:27:25 +0000 (-0400) Subject: Check for the existence of sys.stderr.isatty before calling it. X-Git-Tag: v3.2.0b1~70 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=689d9c8e9a48e4695a8b172ff5b02a6ba41fd7cb;p=thirdparty%2Ftornado.git Check for the existence of sys.stderr.isatty before calling it. Only the `write` method is guaranteed to exist on sys.stderr and sys.stdout. Closes #920. --- diff --git a/tornado/log.py b/tornado/log.py index fa11f3795..648db5c6c 100644 --- a/tornado/log.py +++ b/tornado/log.py @@ -51,7 +51,7 @@ gen_log = logging.getLogger("tornado.general") def _stderr_supports_color(): color = False - if curses and sys.stderr.isatty(): + if curses and hasattr(sys.stderr, 'isatty') and sys.stderr.isatty(): try: curses.setupterm() if curses.tigetnum("colors") > 0: