我不确定Eventlet是否能在OS X上工作,因为epolls不支持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'发布于 2019-11-03 14:22:18
Eventlet不是特定于平台的,但它的集线器可以是特定的。epolls集线器只适用于Linux,它是Eventlet默认值,但您可以对其进行更改。检查Eventlet's hubs docs以选择适合您的情况&在执行任何IO之前调用eventlet.hubs.use_hub。
例如,使用独立于平台的selects集线器:
import eventlet
eventlet.hubs.use_hub("selects")https://stackoverflow.com/questions/58458590
复制相似问题