From 9967738de6ca4ea789a842ce9cd1e7a76e40afd0 Mon Sep 17 00:00:00 2001 From: Ales Erjavec Date: Thu, 30 Jun 2016 19:18:36 +0200 Subject: [PATCH] [FIX] Fix an logging error on windows An error in `fix_win_pythonw_std_stream` prevented it from setting a valid stream to stderr/stdout. Without a valid stderr stream the logging module raises errors when attempting to write to stderr. --- Orange/canvas/__main__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Orange/canvas/__main__.py b/Orange/canvas/__main__.py index adc7417e89c..719e55de8f8 100644 --- a/Orange/canvas/__main__.py +++ b/Orange/canvas/__main__.py @@ -77,10 +77,10 @@ def fix_win_pythonw_std_stream(): """ if sys.platform == "win32" and \ os.path.basename(sys.executable) == "pythonw.exe": - if sys.stdout is not None and sys.stdout.fileno() < 0: - sys.stdout = open(os.devnull, "wb") - if sys.stdout is not None and sys.stderr.fileno() < 0: - sys.stderr = open(os.devnull, "wb") + if sys.stdout is None: + sys.stdout = open(os.devnull, "w") + if sys.stderr is None: + sys.stderr = open(os.devnull, "w") def make_sql_logger(level=logging.INFO):