EOF:在Python中读取原始输入的行时出现EOF
因此,我在Python中运行了几个线程,我试图在每个线程中获取一个值,我希望用户能够输入一个条目,以便在返回值后启动线程,例如:EOF:在Python中读取原始输入的行时出现EOF,python,Python,因此,我在Python中运行了几个线程,我试图在每个线程中获取一个值,我希望用户能够输入一个条目,以便在返回值后启动线程,例如: def adding(self): print 'Hello' name = raw_input("Press enter once hello is printed... ") execute rest of function ......... 但是,当我执行此操作时,会出现以下错误: File "/System/Library/Frame
def adding(self):
print 'Hello'
name = raw_input("Press enter once hello is printed... ")
execute rest of function .........
但是,当我执行此操作时,会出现以下错误:
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 810, in __bootstrap_inner
self.run()
File "/Users/xxx/xxx/xxx.py", line 495, in run
self.adding()
File "/Users/xxx/xxx/xxx.py", line 285, in adding
name = raw_input("Press enter once hello is printed... ")
EOFError: EOF when reading a line
我做错了什么,或者怎样才能改变它来做我想做的事。看一看,你能给出一个更完整的例子吗?如果您在多个线程上调用
raw\u input
,那么大多数线程在退出时都会得到eoferor
。如果发生的时间早于此(并且您没有读取重定向文件或管道,用户也没有按Ctrl-D等),那么这显然是一个不同的问题,但是如果不进行测试,很难猜测问题是什么或调试它。