Skip to content

Instantly share code, notes, and snippets.

@piekstra
piekstra / windows_aiohttps_patch.py
Created April 9, 2021 17:12
A Windows OS-specific HACK workaround to silence an exception thrown on the asyncio event loop being closed
# Windows OS-specific HACK to silence exception thrown on event loop being closed
# as part of the asyncio library's proactor
# Hack sourced from an issue on the aiohttp library:
# https://github.com/aio-libs/aiohttp/issues/4324#issuecomment-733884349
# This assumes you have the asyncio library installed
import platform
if platform.system() == 'Windows':
from functools import wraps
from asyncio.proactor_events import _ProactorBasePipeTransport