Python 3 asyncio selectors fix #344
1 changed files with 9 additions and 1 deletions
|
@ -2,6 +2,15 @@ import sys
|
||||||
from twisted.internet import asyncioreactor
|
from twisted.internet import asyncioreactor
|
||||||
if 'twisted.internet.reactor' not in sys.modules:
|
if 'twisted.internet.reactor' not in sys.modules:
|
||||||
asyncioreactor.install()
|
asyncioreactor.install()
|
||||||
|
|||||||
|
else:
|
||||||
|
from twisted.internet import reactor
|
||||||
|
if not isinstance(reactor, asyncioreactor.AsyncioSelectorReactor) and getattr(sys, 'frozen', False):
|
||||||
|
# pyinstaller hooks install the default reactor before
|
||||||
|
# any of our code runs, see kivy for similar problem:
|
||||||
|
# https://github.com/kivy/kivy/issues/4182
|
||||||
|
del sys.modules['twisted.internet.reactor']
|
||||||
|
asyncioreactor.install()
|
||||||
|
from twisted.internet import reactor
|
||||||
|
|
||||||
import keyring.backend
|
import keyring.backend
|
||||||
import platform
|
import platform
|
||||||
|
@ -81,7 +90,6 @@ keyring.set_keyring(LbryAndroidKeyring())
|
||||||
|
|
||||||
import logging.handlers
|
import logging.handlers
|
||||||
from lbrynet.core import log_support
|
from lbrynet.core import log_support
|
||||||
from twisted.internet import defer, reactor
|
|
||||||
|
|
||||||
from lbrynet import analytics
|
from lbrynet import analytics
|
||||||
from lbrynet import conf
|
from lbrynet import conf
|
||||||
|
|
Loading…
Reference in a new issue
This might lead to confusing results if the wrong reactor was installed previously. I think it would better to either 1) just
asyncioreactor.install()
without putting it inside of a conditional or, alternately, 2) add anelse
to the existing condition which checks that the reactor installed previously is in fact anasyncioreactor
.