Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

eventlet on OS X?

I'm not sure if Eventlet works on OS X because epolls doesn't support OS X.

Traceback (most recent call last):
  File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 917, in _bootstrap_inn
er
    self.run()
  File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/threading.py", line 865, in run
    self._target(*self._args, **self._kwargs)
  File "scraper.py", line 44, in thread_worker
    with eventlet.Timeout(60, False):
  File "/usr/local/lib/python3.7/site-packages/eventlet/timeout.py", line 55, in __init__
    self.start()
  File "/usr/local/lib/python3.7/site-packages/eventlet/timeout.py", line 66, in start
    self.timer = get_hub().schedule_call_global(
  File "/usr/local/lib/python3.7/site-packages/eventlet/hubs/__init__.py", line 117, in get_hub
    use_hub()
  File "/usr/local/lib/python3.7/site-packages/eventlet/hubs/__init__.py", line 71, in use_hub

    mod = get_default_hub()
  File "/usr/local/lib/python3.7/site-packages/eventlet/hubs/__init__.py", line 40, in get_default_hub
    return eventlet.hubs.epolls
AttributeError: module 'eventlet.hubs' has no attribute 'epolls'
like image 506
User Avatar asked Oct 16 '22 10:10

User


1 Answers

Eventlet is not platform-specific but its hubs can be. The epolls hub is only for Linux and it is Eventlet's default but you can change it. Check Eventlet's hubs docs to pick the right one for your situation & call eventlet.hubs.use_hub before performing any IO.

Example, using the platform-independent selects hub:

import eventlet
eventlet.hubs.use_hub("selects")
like image 162
Cole Avatar answered Oct 21 '22 08:10

Cole