title: python subprocess hide stdout and wait it to complete
body: <p>I have this code:</p>
  
  <pre><code>def method_a(self):
      command_line = 'somtoolbox GrowingSOM ' + som_prop_path
      subprocess.Popen(shlex.split(command_line))
      ......
  
  def method_b(self): .....
  ....
  </code></pre>
  
  <p>and like you all see, method_a has a subprocess that is calling the somtoolbox program. But this program have a long stdout, and I want to hide it. I tried:</p>
  
  <pre><code>subprocess.Popen(shlex.split(command_line), stdout=subprocess.PIPE)
  </code></pre>
  
  <p>But it returned this sentence:</p>
  
  <pre><code>cat: record error: Broked Pipe   
  </code></pre>
  
  <p>(this is a translation of the portuguese sentence: "cat: erro de gravação: Pipe quebrado")
  (I'm from brazil)</p>
  
  <p>Also, I have other methods (like method_b there), that are called after the method_a, and tis methods are running before the subprocess complete the process.</p>
  
  <p>How I can hide the stdout at all (and don't want it anywhere), and make the other code wait for the subprocess to finish the execution ?</p>
  
  <p>Obs: The somtoolbox is a java program, that gives the long output to the terminal. 
  Tried:</p>
  
  <pre><code>outputTuple = subprocess.Popen(shlex.split(command_line), stdout = subprocess.PIPE).communicate()
  </code></pre>
  
  <p>but continuous returning output to the shell.
  Help!</p>