From 441b3f16463a0b3b6f38b0f0b3b1306627b32b16 Mon Sep 17 00:00:00 2001 From: Ebag333 Date: Sat, 11 Feb 2017 11:59:49 -0800 Subject: [PATCH] Handle print() messages when not frozen and in debug. We only want to exclude handling stacktraces, so the IDE gets clickable line numbers. --- pyfa.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/pyfa.py b/pyfa.py index 6526e4f18..3102308ce 100755 --- a/pyfa.py +++ b/pyfa.py @@ -232,17 +232,19 @@ if __name__ == "__main__": with logging_setup.threadbound(): # Don't redirect if frozen - if not hasattr(sys, 'frozen') and not options.debug: + if not hasattr(sys, 'frozen'): # Output all stdout (print) messages as warnings try: sys.stdout = LoggerWriter(pyfalog.warning) except ValueError, Exception: pyfalog.critical("Cannot access log file. Continuing without writing stdout to log.") - # Output all stderr (stacktrace) messages as critical - try: - sys.stderr = LoggerWriter(pyfalog.critical) - except ValueError, Exception: - pyfalog.critical("Cannot access log file. Continuing without writing stderr to log.") + + if not options.debug: + # Output all stderr (stacktrace) messages as critical + try: + sys.stderr = LoggerWriter(pyfalog.critical) + except ValueError, Exception: + pyfalog.critical("Cannot access log file. Continuing without writing stderr to log.") pyfalog.info("Starting Pyfa") pyfalog.info("Running in logging mode: {0}", logging_mode)