diff --git a/socialscan/__main__.py b/socialscan/__main__.py index 8711bcf..c05d986 100644 --- a/socialscan/__main__.py +++ b/socialscan/__main__.py @@ -3,11 +3,21 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. import asyncio +import sys from socialscan import cli def main(): + # To avoid 'Event loop is closed' RuntimeError due to compatibility issue with aiohttp + if sys.platform.startswith("win") and sys.version_info >= (3, 8): + try: + from asyncio import WindowsSelectorEventLoopPolicy + except ImportError: + pass + else: + if not isinstance(asyncio.get_event_loop_policy(), WindowsSelectorEventLoopPolicy): + asyncio.set_event_loop_policy(WindowsSelectorEventLoopPolicy()) asyncio.run(cli.main())