[New-bugs-announce] [issue40851] subprocess.Popen: impossible to show console window when shell=True

akdor1154 report at bugs.python.org
Wed Jun 3 00:54:30 EDT 2020

New submission from akdor1154 <akdor1154 at gmail.com>:

Hi all,
It seems impossible to show a new console window with calling subprocess.Popen on windows with shell=True.

    si = subprocess.STARTUPINFO()
    si.dwFlags = subprocess.STARTF_USESHOWWINDOW
    si.wShowWindow = 5
    proc = Popen(
        cmd, cwd=runFolder, creationflags=subprocess.CREATE_NEW_CONSOLE, shell=True,

In the current source, it looks like this is due to the block in https://github.com/python/cpython/blob/master/Lib/subprocess.py#L1405 , which unreservedly wipes wShowWindow even if I have provided it.

Testing on Python 3.6 but I am assuming this affects all versions.

components: Windows
messages: 370639
nosy: akdor1154, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: subprocess.Popen: impossible to show console window when shell=True
versions: Python 3.10, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list