title: How to run an inline shell script from python?
body: <p>I have a small shell script in a string inside my python file.<br>
  Now I'd like to run this script via <code>subprocess.call()</code> and I wonder what's the best way.</p>
  
  <p>My first thought was to write the script to a <code>StringIO</code> and specify that via <code>stdin=...</code> but unfortunately you cannot specify a <code>StringIO</code> since it doesn't have a <code>fileno()</code> method.</p>
  
  <p>Of course I could use <code>stdin=subprocess.PIPE</code> and then write to it using <code>subprocess.communicate()</code> but I wonder if there's a simpler method.</p>