This commit is contained in:
William Fu-Hinthorn
2024-02-01 08:25:09 -08:00
parent e87fb145fa
commit 00a976ebb6
+6 -1
View File
@@ -1,7 +1,11 @@
import asyncio
import logging
import nest_asyncio
logger = logging.getLogger(__name__)
def apply():
nest_asyncio.apply()
@@ -16,10 +20,11 @@ def apply():
try:
# invoke the original method...
_original_del(self)
except:
except Exception as e: # type: ignore
# ... but ignore any exceptions it might raise
# NOTE: horrible anti-pattern. Just using because
# jupyter notebooks don't play nice with asyncio
logger.debug(f"Exception in __del__ of {self}: {e}")
pass
# replace the original __del__ method