title: Launch a totally independent process from Python
body: <p>I'm trying to launch a completely independent process from python.  I can't use something simple like <code>os.startfile</code> since I need to pass arguments. Currently I'm using <code>subprocess.popen</code> which gets me 90% of the way there.</p>
  <pre><code>args = [&quot;some_exe.exe&quot;, &quot;some_arg&quot;, &quot;another_arg&quot;]
  subprocess.Popen(args, creationflags=DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE)
  </code></pre>
  <p>Using <code>popen</code> with detached creation flags &amp; pipes for std* does start a new process that lives after the parent process dies.  So thats all good.  The problem is that the new 'child' process still holds a phantom handle to the parent.  So if I try to uninstall the parent exe (my python script is bundled into an exe via pyinstaller) msiexec complains that the parent exe is still in use.</p>
  <p>So the goal is to spawn a totally independent process to run &quot;some_exe.exe&quot; that doesn't have any handle back to the original process.</p>
  <p>Note: This is for Windows XP and above.  I'm developing on Win7.</p>