stdout=subprocess.PIPE
has no effect on whether or not a console appears. It just determines whether or not the stdout
of the subprocess is captured in a pipe that you can read from or not.
shell=False
is the default for all subprocess
commands, so you don't need to provide it. It tells subprocess
whether or not to use a shell to execute the provided command. It does not have any effect on whether or not a console appears on any platform.
creationflags = CREATE_NO_WINDOW
will indeed hide the console on Windows (tested on Windows 7, assuming CREATE_NO_WINDOW == 0x08000000
). It will cause an error to use it on non-Windows platforms, though. You should reference this question for a way to only provide creationflags
on Windows, and also for alternative way to hide the console.
Note that the console appearing should only be an issue on Windows. On Posix platforms the console shouldn't ever appear when running subprocesses.