Support for Windows Python3 pythonw.exe

This commit is contained in:
Josip 2016-11-12 14:05:49 +01:00
parent 905717f4f1
commit bb919efec7

View File

@ -74,10 +74,13 @@ try:
_encoding = sys.stdout.encoding
except:
_encoding = "UTF-8"
try:
sys.stdout = open(sys.stdout.fileno(), mode='w', encoding=_encoding,
buffering=1, errors='backslashreplace')
sys.stderr = open(sys.stderr.fileno(), mode='w', encoding=_encoding,
buffering=1, errors='backslashreplace')
except:
pass
#-------------------------------------------------------------------------
#
@ -100,7 +103,7 @@ form = logging.Formatter(fmt="%(asctime)s.%(msecs).03d: %(levelname)s: "
# Create the log handlers
if win():
# If running in GUI mode redirect stdout and stderr to log file
if hasattr(sys.stdout, "fileno") and sys.stdout.fileno() < 0:
if not sys.stdout:
logfile = os.path.join(HOME_DIR,
"Gramps%s%s.log") % (VERSION_TUPLE[0],
VERSION_TUPLE[1])