]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Check for the existence of sys.stderr.isatty before calling it.
authorBen Darnell <ben@bendarnell.com>
Sat, 26 Oct 2013 22:27:25 +0000 (18:27 -0400)
committerBen Darnell <ben@bendarnell.com>
Sat, 26 Oct 2013 22:27:25 +0000 (18:27 -0400)
Only the `write` method is guaranteed to exist on sys.stderr and sys.stdout.

Closes #920.

tornado/log.py

index fa11f37953598f9dd442344546a208e3a5650760..648db5c6c7b3e5e4f395e6fcc9b8805fa62343b6 100644 (file)
@@ -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: