Skip to content Skip to sidebar Skip to footer

Executing Subprocess From Python Without Opening Windows Command Prompt

Possible Duplicate: Running a process in pythonw with Popen without a console How do I eliminate Windows consoles from spawned processes in Python (2.7)? I have a Python program

Solution 1:

How are you calling subprocess.check_call()? If you pass shell=True then the window should not be created as this will cause the SW_HIDE flag to be set for the STARTUPINFO.wShowWindow attribute.

Example:

subprocess.check_call(["ping", "google.com"], shell=True)

Solution 2:

When you build the C application, set its type to the Win32 Subsystem instead of the Console Subsystem. If this is a pre-built application, you could change the subsystem with this tool.

Post a Comment for "Executing Subprocess From Python Without Opening Windows Command Prompt"