subprocess.Popen in different console

Ionut Hulub picture Ionut Hulub · Apr 9, 2013 · Viewed 50.1k times · Source

I hope this is not a duplicate.

I'm trying to use subprocess.Popen() to open a script in a separate console. I've tried setting the shell=True parameter but that didn't do the trick.

I use a 32 bit Python 2.7 on a 64 bit Windows 7.

Answer

Pedro Vagner picture Pedro Vagner · Dec 16, 2013

To open in a different console, do (tested on Win7 / Python 3):

from subprocess import Popen, CREATE_NEW_CONSOLE

Popen('cmd', creationflags=CREATE_NEW_CONSOLE)

input('Enter to exit from Python script...')

Related

How can I spawn new shells to run python scripts from a base python script?