title: How do I pass a string into subprocess.Popen (using the stdin argument)?
body: <p>If I do the following:</p>
  
  <pre><code>import subprocess
  from cStringIO import StringIO
  subprocess.Popen(['grep','f'],stdout=subprocess.PIPE,stdin=StringIO('one\ntwo\nthree\nfour\nfive\nsix\n')).communicate()[0]
  </code></pre>
  
  <p>I get:</p>
  
  <pre><code>Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in ?
    File "/build/toolchain/mac32/python-2.4.3/lib/python2.4/subprocess.py", line 533, in __init__
      (p2cread, p2cwrite,
    File "/build/toolchain/mac32/python-2.4.3/lib/python2.4/subprocess.py", line 830, in _get_handles
      p2cread = stdin.fileno()
  AttributeError: 'cStringIO.StringI' object has no attribute 'fileno'
  </code></pre>
  
  <p>Apparently a cStringIO.StringIO object doesn't quack close enough to a file duck to suit subprocess.Popen.  How do I work around this?</p>