title: subprocess.Popen execve() arg 3 contains a non-string value
body: <p>I'm trying to trying to run another script via the shell, that uses a modified set of environment variables.</p>
  
  <pre><code>def cgi_call(script, environ):
      pSCRIPT = subprocess.Popen(script, stdout=subprocess.PIPE, stderr=subprocess.PIPE, 
                          stdin=subprocess.PIPE, env=environ, shell=True)
  
      pc = pSCRIPT.communicate()
  
      status = "200 OK"
      headers = [('Content-Type',"text/html")]
      if pc[1] != '':
          raise RuntimeError, pc[1]
      else:
          rval = str(pc[0])
  
      return status, headers, rval
  </code></pre>
  
  <p>After running the code above, I get the following error:</p>
  
  <pre><code>File "server/httpd.py", line 76, in DynamicServer
      status, headers, rval = handler(environ)
  File "server/httpd.py", line 43, in handler
      status, headers, rval = cgi_call(srvpath+"../www/public_html"+environ["PATH_INFO"]+'index.py',environ)
  File "server/httpd.py", line 21, in cgi_call
      stdin=subprocess.PIPE, env=environ, shell=True)
  File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
      errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child
      raise child_exception
  &lt;type 'exceptions.TypeError'&gt; execve() arg 3 contains a non-string value
  </code></pre>
  
  <p>The error comes when passing the environment variables... I've also tried passing them as a string - It errors out and says that it needs a mapping object. However, as it is, the environ being passed IS a mapping object...</p>
  
  <p>What is the problem?</p>
  
  <p>Additional Information:
  I am running Python 2.7 on Ubuntu 12.04.1</p>