[英]'EOFError: EOF when reading a line' while parsing argv in jupyter notebook
I am running my program on Jupyter-notebook我在 Jupyter-notebook 上运行我的程序
%%file ex14.py
from sys import argv
script, user_name = argv
prompt = '> '
print ("Hi %s, I'm the %s script." % (user_name, script))
print ("I'd like to ask you a few questions.")
print ("Do you like me %s?" % user_name)
likes = (input(prompt))
print ("Where do you live %s?" % user_name)
lives = input(prompt)
print ("What kind of computer do you have?")
computer = input(prompt)
In the next cell在下一个单元格中
%%!
python ex14.py argument
After this program is not asking for the user inputs.在此程序不要求用户输入之后。 Any guidance?有什么指导吗?
The same program is executing fine in terminal
Full error displayed in Jupyter Jupyter 中显示的完整错误
`["Hi argument, I'm the ex14.py script.",
"I'd like to ask you a few questions.",
'Do you like me argument?',
'> Traceback (most recent call last):',
' File "ex15.py", line 7, in <module>',
' likes = (input(prompt))',
'EOFError: EOF when reading a line']`
Because in Jupyter Notebook因为在 Jupyter Notebook
%%!
python ex14.py argument
return your value in List.在列表中返回您的值。 Use this %run
instead of %%! python
使用这个%run
而不是%%! python
%%! python
%run ex14.py argument
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.