syg*_*eto 6 python subprocess tkinter
tkinter当我使用运行时,我的程序运行良好PyCharm,当.exe使用pyinstaller 创建文件时,pyinstaller -i"icon.ico" -w -F script.py
没有任何错误。我将其粘贴script.exe到与我的文件夹相同的文件夹中script.py,并在运行它之后在步骤中认为subprocess它没有应答,因为我print在子进程行及其工作之前。
有人知道为什么吗?
这是带有子流程的行:
import subprocess
from subprocess import Popen, PIPE
s = subprocess.Popen([EXE,files,'command'],shell=True, stdout=subprocess.PIPE)
Run Code Online (Sandbox Code Playgroud)
编辑:
同样的问题:
s = subprocess.check_output([EXE,files,'command'],shell=True, stderr=subprocess.STDOUT)
Run Code Online (Sandbox Code Playgroud)
您可以在-w模式或--windowed中编译代码,但随后还必须分配stdin和stderr。
所以改变:
s = subprocess.Popen([EXE,files,'command'],shell=True, stdout=subprocess.PIPE)
Run Code Online (Sandbox Code Playgroud)
至:
s = subprocess.Popen([EXE,files,'command'],shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE)
Run Code Online (Sandbox Code Playgroud)