From 012482ce108621288d21d961eb2756d4093c8983 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 25 Aug 2014 10:52:38 +0200 Subject: [PATCH] Fix colorama log issues on Windows when frozen. With the new version of colorlog, colorama.init() gets called when opening colorlog, which then lead to sys.stderr not being None anymore (but a wrapped "None"), which lead to an exception when we checked isatty(). We now just unwrap these again. --- qutebrowser/utils/log.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/qutebrowser/utils/log.py b/qutebrowser/utils/log.py index 2de8283a8..dfc095118 100644 --- a/qutebrowser/utils/log.py +++ b/qutebrowser/utils/log.py @@ -36,6 +36,11 @@ try: from colorlog import ColoredFormatter except ImportError: ColoredFormatter = None +else: + # colorlog calls colorama.init() which breaks our sys.stdout/sys.stderr if + # they are None. + sys.stderr = sys.__stderr__ + sys.stdout = sys.__stdout__ try: # pylint: disable=import-error import colorama