When the function below is entered into a notebook cell, the output will have an input box to enter the details of the prompt.
def a():
val = raw_input("abc")
print "Entered value: %s" % val
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 sample.py
as below.
# cat sample.py
def a():
val = raw_input("abc")
print "Entered value: %s" % val
a()
Attempts to achieve the same behavior of getting a notebook prompt while running the script from notebook:
1. Using the '!' prefix
This command just keeps running without giving any prompt:
[*] !python sample.py
abc
2. Using %%bash
Gives the following error:
%%bash
python sample.py
EOFError: EOF when reading a line
What is the reason for this to fail and is there a workaround to get it working as expected?