Gevent无法正常工作。我想下面会永远阻止但我得到以下错误。
from gevent import monkey; monkey.patch_all()
import gevent
import gevent.queue
queue = gevent.queue.Queue()
queue.get(block=True, timeout=None)
File "/home/ubuntu/workspace/zenserver/upload_pusher.py", line 53, in proccess_file
filepath = queue.get(block=True, timeout=None)
File "/usr/local/lib/python2.7/dist-packages/gevent-1.0b2-py2.7-linux-x86_64.egg/gevent/queue.py", line 189, in get
result = waiter.get()
File "/usr/local/lib/python2.7/dist-packages/gevent-1.0b2-py2.7-linux-x86_64.egg/gevent/hub.py", line 616, in get
return self.hub.switch()
File "/usr/local/lib/python2.7/dist-packages/gevent-1.0b2-py2.7-linux-x86_64.egg/gevent/hub.py", line 373, in switch
return greenlet.switch(self)
gevent.hub.LoopExit: This operation would block forever
答案 0 :(得分:0)
你得到了那个例外,因为没有其他greenlet可以切换到。你曾经问过唯一的greenlet(主要的greenlet)要阻止,但是它没有办法醒来(因为没有其他的greenlets)。基本上这是gevent让你知道一个僵局。