Change the Event Loop to 'Selector'

Python 3.8 now returns the ProactorEventLoop which does not implement add_writer/add_reader. For now, switch to SelectorEventLoop.
This commit is contained in:
Brishen 2020-01-06 15:39:16 -07:00 committed by GitHub
parent 18f2d67f34
commit 12dd9a1da1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,8 +3,11 @@ import asyncio # isort:skip
import sys # isort:skip
import warnings # isort:skip
from twisted.internet import asyncioreactor # isort:skip
import selectors
selector = selectors.SelectSelector()
twisted_loop = asyncio.SelectorEventLoop(selector)
twisted_loop = asyncio.new_event_loop()
current_reactor = sys.modules.get("twisted.internet.reactor", None)
if current_reactor is not None:
if not isinstance(current_reactor, asyncioreactor.AsyncioSelectorReactor):