Код: Выделить всё
import multiprocessing as mp
class MainWindow(BaseWindow):
def __init__(self, app: QApplication, ui: Ui_MainWindow) -> None:
super(MainWindow, self).__init__(app, ui)
self.pool = mp.Pool(initializer=init_logging)
Код: Выделить всё
self.pool = mp.Pool(initializer=init_logging)Часть Код: Выделить всё
@echo off
pyinstaller --noconfirm --onefile --windowed --icon "epey.ico" --add-data "log_config.json;." --add-data "JSONFormatter.py;." --distpath ./dist "main.py"
del main.spec
pause
Что я пробовал:
- Я пытался удалить:
Код: Выделить всё
def init_logging():
log_dir = Path("logs")
if not log_dir.exists():
log_dir.mkdir()
if getattr(sys, "frozen", False) and hasattr(sys, "_MEIPASS"):
config_file = Path(sys._MEIPASS) / "log_config.json" # type: ignore
else:
config_file = Path("log_config.json")
with open(config_file) as f:
config = json.load(f)
logging.config.dictConfig(config)
queue_handler = logging.getHandlerByName("queue_handler")
if queue_handler is not None:
queue_handler.listener.start() # type: ignore
atexit.register(queue_handler.listener.stop) # type: ignore
Чего я ожидал
- Программа, которая не размножается, открывает только одно окно, работает нормально.
Подробнее здесь: https://stackoverflow.com/questions/790 ... d-into-exe