File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -159,9 +159,19 @@ def main():
159159 whitelist = set (sys .argv [1 :])
160160
161161 if platform .system () == "Windows" :
162- asyncio .set_event_loop (asyncio .ProactorEventLoop ())
163-
164- asyncio .get_event_loop ().run_until_complete (generate (whitelist , verbose ))
162+ # for python version prior to 3.8, loop policy needs to be set explicitly
163+ # https://docs.python.org/3/library/asyncio-policy.html#asyncio.DefaultEventLoopPolicy
164+ try :
165+ asyncio .set_event_loop_policy (asyncio .WindowsProactorEventLoopPolicy ())
166+ except AttributeError :
167+ # python < 3.7 does not have asyncio.WindowsProactorEventLoopPolicy
168+ asyncio .get_event_loop_policy ().set_event_loop (asyncio .ProactorEventLoop ())
169+
170+ try :
171+ asyncio .run (generate (whitelist , verbose ))
172+ except AttributeError :
173+ # compatibility code for python < 3.7
174+ asyncio .get_event_loop ().run_until_complete (generate (whitelist , verbose ))
165175
166176
167177if __name__ == "__main__" :
You can’t perform that action at this time.
0 commit comments