mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-17 17:42:20 +03:00
Re-order imports so stdout/err redirect works for logging
too.
Else the StreamHandler gets created with old stdout/err and causes py2exe to attempt to write log file to CWD, which doesn't work when installed.
This commit is contained in:
parent
87324661d9
commit
611db09fd0
@ -15,14 +15,6 @@ from sys import platform
|
||||
from time import localtime, strftime, time
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from EDMCLogging import edmclogger, logger, logging
|
||||
|
||||
# See EDMCLogging.py docs.
|
||||
# isort: off
|
||||
if TYPE_CHECKING:
|
||||
from logging import trace, TRACE # type: ignore # noqa: F401
|
||||
# isort: on
|
||||
|
||||
from config import applongname, appname, appversion, appversion_nobuild, config, copyright
|
||||
|
||||
# TODO: Test: Make *sure* this redirect is working, else py2exe is going to cause an exit popup
|
||||
@ -36,6 +28,15 @@ if __name__ == "__main__":
|
||||
# unbuffered not allowed for text in python3, so use `1 for line buffering
|
||||
sys.stdout = sys.stderr = open(join(tempfile.gettempdir(), f'{appname}.log'), mode='wt', buffering=1)
|
||||
|
||||
from EDMCLogging import edmclogger, logger, logging
|
||||
|
||||
# See EDMCLogging.py docs.
|
||||
# isort: off
|
||||
if TYPE_CHECKING:
|
||||
from logging import trace, TRACE # type: ignore # noqa: F401
|
||||
# isort: on
|
||||
|
||||
|
||||
if getattr(sys, 'frozen', False):
|
||||
# Under py2exe sys.path[0] is the executable name
|
||||
if platform == 'win32':
|
||||
|
Loading…
x
Reference in New Issue
Block a user