gevent.hub.LoopExit: ('This operation would block forever')
DixitPatel opened this issue · comments
I installed zimply and while importing the library through jupyter notebook it throws this error in the console (the importing doesn't complete) :
[IPKernelApp] ERROR | Exception in message handler:
......
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/threading.py", line 293, in wait
waiter.acquire()
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/gevent/thread.py", line 84, in acquire
return BoundedSemaphore.acquire(self, blocking, timeout)
File "src/gevent/_semaphore.py", line 198, in gevent._semaphore.Semaphore.acquire (src/gevent/gevent._semaphore.c:4541)
File "src/gevent/_semaphore.py", line 226, in gevent._semaphore.Semaphore.acquire (src/gevent/gevent._semaphore.c:4367)
File "src/gevent/_semaphore.py", line 166, in gevent._semaphore.Semaphore._do_wait (src/gevent/gevent._semaphore.c:3562)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/gevent/hub.py", line 630, in switch
return RawGreenlet.switch(self)
gevent.hub.LoopExit: ('This operation would block forever', <Hub at 0x104a81b90 select default pending=0 ref=0>)
ERROR:tornado.general:Uncaught exception, closing connection.
How do I resolve this error ? Any inputs
gevent/gevent#585
Similar issue raised here and suggestion I checked the zimply.py and it uses that suggestion.
I have no idea why the error occurs. The monkey patching is very important though, and rather picky about the order in which it executes. You may want to try to import the monkey yourself and do the patching as the very first thing you do, before importing any other libraries and before writing any other code. The monkey patching tries to make the Python library cooperative, but it doesn't work retroactively. So try adding:
from gevent import monkey
monkey.patch_all()
as the very first two lines in your code.