title: Pipe input to script and later get input from user
body: <p>Let's say I want to pipe input to a Python program, and then later get input from the user, on the command line.</p>
  
  <pre><code>echo http://example.com/image.jpg | python solve_captcha.py
  </code></pre>
  
  <p>and the contents of <code>solve_captcha.py</code> are:</p>
  
  <pre><code>import sys 
  image_url = sys.stdin.readline()
  
  # Download and open the captcha...
  
  captcha = raw_input("Solve this captcha:")
  # do some processing...
  </code></pre>
  
  <p>The above will trigger a <code>EOFError: EOF when reading a line</code> error.</p>
  
  <p>I also tried adding a <code>sys.stdin.close()</code> line, which prompted a <code>ValueError: I/O operation on closed file</code>. </p>
  
  <p>Can you pipe information to <code>stdin</code> and then later get input from the user?</p>
  
  <p><strong>Note:</strong> This is a stripped down, simplified example - please don't respond by saying "why do you want to do that in the first case," it's really frustrating. I just want to know whether you can pipe information to <code>stdin</code> and then later prompt the user for input.</p>