Support for Windows Python3 pythonw.exe
This commit is contained in:
parent
bc51334178
commit
4a583e187c
@ -74,10 +74,15 @@ try:
|
||||
_encoding = sys.stdout.encoding
|
||||
except:
|
||||
_encoding = "UTF-8"
|
||||
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')
|
||||
|
||||
try:
|
||||
# On Windows there is no std handles in GUI mode
|
||||
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 +105,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])
|
||||
|
Loading…
Reference in New Issue
Block a user