This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author paul.moore
Recipients paul.moore, steve.dower, tim.golden, zach.ware
Date 2020-08-23.12:54:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1598187250.65.0.957662639779.issue41619@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2020-08-23 12:54:10paul.mooresetrecipients: + paul.moore, tim.golden, zach.ware, steve.dower
2020-08-23 12:54:10paul.mooresetmessageid: <1598187250.65.0.957662639779.issue41619@roundup.psfhosted.org>
2020-08-23 12:54:10paul.moorelinkissue41619 messages
2020-08-23 12:54:10paul.moorecreate