title: Python subprocess only giving 1 output instead of 2
body: <p>I want to generate 2 certificates using openssl and python subprocess, which are <code>key.pem</code> and <code>cert.pem</code>
  and is using the below command to do so.</p>
  
  <pre><code>openssl req -newkey rsa:2048 -nodes -keyout key.pem -x509 -days 365 -out certificate.pem
  </code></pre>
  
  <p>this command is working perfectly when executed from the termnial, but when it's being executed from the python script with the help of python subprocess its only giving output the <code>key.pem</code> file in the desired directory and not the <code>cert.pem</code> file.
  Below is the code snippet from the python script:</p>
  
  <pre><code>    tempdirname = 'temp_cert/'
      keyname = 'key.pem'
      certname = 'cert.pem'
  
      expiration_period = '500'
      cmd = ['openssl', 'req', '-newkey', 'rsa:2048', '-nodes', '-keyout', tempdirname+keyname, '-x509', '-days', expiration_period, '-out', tempdirname+certname]
      p = subprocess.Popen(
          cmd,
          stdin=subprocess.PIPE,
          stdout=subprocess.PIPE,
          stderr=subprocess.PIPE,
          shell=False
      )
      out, err = p.communicate('\n')
  </code></pre>
  
  <p>I also want the <code>cert.pem</code> file is the same directory. What should I do?
  I am using python 2.7</p>