title: How to use creationflags=CREATE_NO_WINDOW with subprocess.run?
body: <p>I'm trying to create a simple python/tkinter UI to run cygwin commands from Windows.</p>
  
  <p>To avoid getting a command window, I'm starting my python script with pythonw.exe.</p>
  
  <p>Here's the code that runs the cygwin command:</p>
  
  <pre class="lang-py prettyprint-override"><code>def exec_ls():
      clear_log(log)
      print_log(log, "*** Running ls -lsa ***\n")
      s = subprocess.run(
          ["C:/cygwin/bin/ksh.exe", "-c", ". /etc/profile; ls -1 c:/test"],
          stdout=PIPE,
          stderr=STDOUT,
      )
      print_log(log, s.stdout)
      print_log(log, "\n*** END ***")
  
  </code></pre>
  
  <p>This runs successfully, but when exec_ls() is invoked, an empty command window flashes.</p>
  
  <p>To remove the occurrence of this window, I tried to use creationflags as follows:</p>
  
  <pre class="lang-py prettyprint-override"><code>def exec_ls():
      clear_log(log)
      print_log(log, "*** Running ls -lsa ***\n")
      s = subprocess.run(
          ["C:/cygwin/bin/ksh.exe", "-c", ". /etc/profile; ls -1 c:/test"],
          stdout=PIPE,
          stderr=STDOUT,
          creationflags=CREATE_NO_WINDOW,
      )
      print_log(log, s.stdout)
      print_log(log, "\n*** END ***")
  </code></pre>
  
  <p>But then I don't get the command window, but the command doesn't run either (no output).</p>
  
  <p>What did I do wrong?</p>
  
  <p>Best regards</p>