don't delete the reactor from sys.modules unless in a build

This commit is contained in:
Jack Robison 2018-10-01 17:38:03 -04:00
parent 673d259d7a
commit 7dcebf99e0
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2

View file

@ -4,12 +4,13 @@ if 'twisted.internet.reactor' not in sys.modules:
asyncioreactor.install()
else:
from twisted.internet import reactor
if not isinstance(reactor, asyncioreactor.AsyncioSelectorReactor):
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 json
import asyncio