New submission from Paul Moore <p.f.mo...@gmail.com>:

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.

----------
components: Windows
messages: 375811
nosy: paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Subprocesses created with DETACHED_PROCESS can pop up a console window
type: behavior
versions: Python 3.8

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue41619>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to