Message375811
The following code pops up an extra console window when run on Windows 10, Python 3.8:
from subprocess import DETACHED_PROCESS, Popen
p = Popen(["py", "-c", "from time import sleep; sleep(5)"], creationflags=DETACHED_PROCESS)
Adding CREATE_NO_WINDOW doesn't help, nor does adding a STARTUPINFO with SW_HIDE.
The problem occurs whether the Python interpreter is started via the py.exe wrapper or the actual python.exe. However, changing the process being run from "py" to sys.executable makes the problem go away. I've seen similar issues when using sys.executable, but the script is being called from a virtualenv.
I can't find any set of options for Popen that reliably avoids showing a console window when invoked like this. |
|
Date |
User |
Action |
Args |
2020-08-23 12:54:10 | paul.moore | set | recipients:
+ paul.moore, tim.golden, zach.ware, steve.dower |
2020-08-23 12:54:10 | paul.moore | set | messageid: <1598187250.65.0.957662639779.issue41619@roundup.psfhosted.org> |
2020-08-23 12:54:10 | paul.moore | link | issue41619 messages |
2020-08-23 12:54:10 | paul.moore | create | |
|