title: Executing Python commands in Jupyter notebook with prompts
body: <p>When the function below is entered into a notebook cell, the output will have an input box to enter the details of the prompt. </p>
  
  <pre><code>def a():
      val = raw_input("abc")
      print "Entered value: %s" % val
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/0a1Zt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0a1Zt.png" alt="enter image description here"></a></p>
  
  <p>I'm trying to achieve the same thing by running the script, but it doesn't work. I've copied the same code for the function above into a script <code>sample.py</code> as below. </p>
  
  <pre><code># cat sample.py
  def a():
      val = raw_input("abc")
      print "Entered value: %s" % val
  
  a()
  </code></pre>
  
  <p>Attempts to achieve the same behavior of getting a notebook prompt while running the script from notebook: </p>
  
  <p><strong>1. Using the '!' prefix</strong> </p>
  
  <p>This command just keeps running without giving any prompt: </p>
  
  <pre><code>[*] !python sample.py
  abc
  </code></pre>
  
  <p><strong>2. Using <code>%%bash</code></strong></p>
  
  <p>Gives the following error: </p>
  
  <pre><code>%%bash
  python sample.py
  EOFError: EOF when reading a line
  </code></pre>
  
  <p>What is the reason for this to fail and is there a workaround to get it working as expected? </p>