title: Conflict between sys.stdin and input() - EOFError: EOF when reading a line
body: <p>I can't get the following script to work without throwing an EOFError exception:</p>
  
  <pre><code>#!/usr/bin/env python3
  
  import json
  import sys
  
  # usage:
  # echo '[{"testname": "testval"}]' | python3 test.py
  
  myjson = json.load(sys.stdin)
  print(json.dumps(myjson))
  
  answer = input("&gt; ")  # BUG: EOFError: EOF when reading a line
  print(answer)
  </code></pre>
  
  <p>I've read this question which seems to be related: <a href="https://stackoverflow.com/questions/35018268/python-stdin-user-input-issue">Python STDIN User Input Issue</a></p>
  
  <p>I think that tells me I need to clear the stdin buffer ? But I'm not sure how because <code>print(sys.stdin.readline())</code> just outputs a newline and the EOFError is still there.</p>
  
  <p>I also tried using the <code>sys.stdin.flush()</code> method (found in this question: <a href="https://stackoverflow.com/questions/10019456/usage-of-sys-stdout-flush-method#10019605">Usage of sys.stdout.flush() method</a>) although I still don't understand what it does because I couldn't find it in the official documentation (3.6), the closest I found was this but it doesn't mention flush: <a href="https://docs.python.org/3/library/sys.html" rel="noreferrer">https://docs.python.org/3/library/sys.html</a></p>
  
  <p>Please bear in mind that I'm not a programmer nor do I have a CS education or background. I just write scripts to automate parts of my, otherwise non-technical, work. So if you know any good beginner ressource on how stdin/stdout works in the shell with Python please do tell.</p>