issue with gevent monkeypatching on python > 3.4
sandys opened this issue · 6 comments
from http://www.gevent.org/gevent.monkey.html
patch_select(aggressive=True)
Replace select.select() with gevent.select.select() and select.poll() with gevent.select.poll (where available).If aggressive is true (the default), also remove other blocking functions from select and (on Python 3.4 and above) selectors:
select.epoll()
select.kqueue()
select.kevent()
select.devpoll() (Python 3.5+)
selectors.EpollSelector
selectors.KqueueSelector
selectors.DevpollSelector (Python 3.5+)
On python 3.6, if i use gevent monkey-patching ("patch_all"), I start to get following errors on pusher.trigger('ssssss', 'client-message', event)
AttributeError: module 'select' has no attribute 'epoll'
really need help on this
Hi there,
I'm having trouble reproducing this, the following file works absolutely fine with python 3.6.1 for me.
from gevent import monkey
monkey.patch_all()
import pusher
pusher_client = pusher.Pusher(
app_id="XXXXXX",
key="XXXXXXXXXXXXXXXXXXXX",
secret="XXXXXXXXXXXXXXXXXXXX",
ssl=True
)
pusher_client.trigger("world", "hello", { "hello": "world" })
Could you try and run the above snippet, and if you are still encountering the error, could I take a look at your installed libraries? (The output of pip3 list
.)
Cheers.
Hi Sandeep,
I see! Apologies, I'm not very familiar with gevent so wasn't really sure what would be required to reproduce. I'll try and take a closer look in to this later today. Thanks for the extra information.
Best,
Callum
Hi Sandeep,
Thanks for the links. I may however still be missing something fundamental... would it be possible for you to provide us with a complete minimal project that reproduces this issue? At the moment I'm running the following file
from gevent import monkey
monkey.patch_all()
import gevent
from pusher import Pusher
pusher = Pusher(
app_id="XXXXXX",
key="XXXXXXXXXXXXXXXXXXXX",
secret="XXXXXXXXXXXXXXXXXXXX",
ssl=True
)
def app(environ, start_response):
pusher.trigger("world", "hello", "data")
data = b"Hello, World!\n"
start_response("200 OK", [
("Content-Type", "text/plain"),
("Content-Length", str(len(data)))
])
return iter([data])
with command gunicorn -k gevent -w 4 main:app
, and all is working well.
Best,
Callum
Closing because there has been no example provided that reproduces the issue. Please re-open if you can provide this.