使用PyInstaller打包;db.json移动到categories中;Popen不打开新窗口

This commit is contained in:
zhbaor 2021-11-04 01:15:50 +08:00
parent b3a3738f6d
commit 8d77a2590d
4 changed files with 71 additions and 5 deletions

View file

@ -1,7 +1,7 @@
from configparser import ConfigParser
from pathlib import Path
from json import dump, dumps
from subprocess import STDOUT, Popen, PIPE
from subprocess import CREATE_NO_WINDOW, STDOUT, Popen, PIPE
from threading import Thread
from queue import Empty, SimpleQueue
from tkinter import *
@ -47,7 +47,7 @@ def generate_db(config: ConfigParser) -> str:
for file in category.iterdir():
output_category["files"].append(file.name)
output.append(output_category)
with open(Path(local_dir, "db.json"), "w") as f:
with open(Path(local_dir, "categories", "db.json"), "w") as f:
dump(output, f)
return dumps(output)
@ -87,7 +87,7 @@ def sync_func(command: list[str]) -> None:
output_queue.put_nowait(f"db.json: {db_log}\n")
output_queue.put_nowait(f"command: {command}\n")
output_queue.put_nowait("Started lftp...\n")
proc = Popen(command, stdout=PIPE, stderr=STDOUT)
proc = Popen(command, stdout=PIPE, stderr=STDOUT, creationflags=CREATE_NO_WINDOW)
ret_val = None
while ret_val is None:
ret_val = proc.poll()