title: The Difference between os.system and subprocess calls
body: <p>I have created a program that creates a web architecture in a local server then loads the necessary browser to display the html and php pages on localhost.</p>
  
  <p>The <code>os.system</code> call kills the python process but doesn't kill the other processes -- for example, <code>httpd.exe</code> and <code>mysqld.exe</code></p>
  
  <p>The <code>subprocess</code> call kills the <code>httpd.exe</code> and <code>mysqld.exe</code> programs but continues to run the python code, and no code executes after the <code>subprocess</code> call.</p>
  
  <p>How would i go about killing or hiding all necessary processes after the python code is executed?</p>
  
  <p>Here is my code.</p>
  
  <pre><code>os.makedirs(dr + x + '/admin' + '/css')
  dobj = open(dr + x + '/admin' + '/css' + '/style.css', 'w')
  dobj.close()
  del dobj
  os.makedirs(dr + x + '/admin' + '/js')
  os.makedirs(dr + x + '/admin' + '/img')
  ################################################################################
  ## THE OS SYSTEM CALLS CLOSE THE APP BUT OPEN THE PROCESSES
  ## AND THE SUBPROCESS CALLS CLOSE BOTH PROCESSES AND LEAVES THE APP OPEN
  ## CANT WIN!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  os.makedirs(dr + x + '/admin' + '/conf')
  #os.system(r'C:\\xampp\\apache\\bin\\httpd.exe')
  #os.system(r'C:\\xampp\\mysql\\bin\\mysqld.exe')
  subprocess.Popen(['C:\\xampp\\apache\\bin\\httpd.exe'], shell=True, creationflags=subprocess.SW_HIDE)
  subprocess.Popen(['C:\\xampp\\mysql\\bin\\mysqld.exe'], shell=True, creationflags=subprocess.SW_HIDE)
  webbrowser.open('localhost/' + x)
  sys.exit()
  ################################################################################
  
  
  else:
      backmaybe = raw_input('Already Exists... Try Again? (Y/N) ')
  if backmaybe == 'y':
      start()
  else:
      sys.exit()
  </code></pre>