How to hide console with Popen on Windows?
Question: I had found this topic and i found this as a solution:

[Module subprocess has no attribute
'STARTF_USESHOWWINDOW'](http://stackoverflow.com/questions/4703983/module-
subprocess-has-no-attribute-startf-useshowwindow)

but when I run code reality differs. :/

  1. Run my code:
    
        # Get the environment variables from OO-Python using subprocess
    oo_py_exec = os.path.join(oo_dir, r'program\python.exe')
    python_oo_script = ' ;'.join([
        "-cimport os",
        "print(os.environ['URE_BOOTSTRAP'])",
        "print(os.environ['UNO_PATH'])",
        "print(os.environ['PATH'])",
    ])
    
    subprocess.STARTF_USESHOWWINDOW
    info = subprocess.STARTUPINFO()
    info.dwFlags = subprocess.STARTF_USESHOWWINDOW
    info.wShowWindow = subprocess.SW_HIDE
    process = subprocess.Popen([oo_py_exec, python_oo_script],
        stdout=subprocess.PIPE, startupinfo=info)
    result = process.communicate()
    

Console is showed.

  1. Run code from link:
    
        kwargs = {}
    if subprocess.mswindows:
         su = subprocess.STARTUPINFO()
         su.dwFlags |= subprocess.STARTF_USESHOWWINDOW
         su.wShowWindow = subprocess.SW_HIDE
         kwargs['startupinfo'] = su 
    subprocess.Popen("cmd.exe", **kwargs)
    

Console is also showed!

win xp, py 2.6


Answer: You shouldn't use `python.exe` but instead `pythonw.exe` \- those are
identical except one does show a console, the other does not (no idea what the
`w` does stand for though).

