Skip to content

Instantly share code, notes, and snippets.

  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Fixes Python asyncio runtime error: event loop closed
"""fix yelling at me error"""
from functools import wraps
from asyncio.proactor_events import _ProactorBasePipeTransport
def silence_event_loop_closed(func):
def wrapper(self, *args, **kwargs):
return func(self, *args, **kwargs)
except RuntimeError as e:
if str(e) != 'Event loop is closed':
return wrapper
_ProactorBasePipeTransport.__del__ = silence_event_loop_closed(_ProactorBasePipeTransport.__del__)
"""fix yelling at me error end"""
Copy link

Hey Man,

Where should i add this piece of code ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment