With either subprocess.call or subprocess.Popen, executing a shell command makes a shell window quicky appear and disappear.
How can I run the shell command without the shell window?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I imagine your observation is limited to Windows, since that, I believe, is the only platform on which you’ll get that “console flash” issue. If so, then the docs offer the following semi-helpful paragraph:
Unfortunately the Python online docs do not reproduce the relevant portion of the Windows API docs, so you have to locate those elsewhere, e.g. starting here on MSDN which leads you here for the
creationflags, and specifically toSo, adding
creationflags=0x08000000to yourPopencall should help (unfortunately I have no Windows-running machine on which to try this out, so you’ll have to try it yourself).