Get running event loop in debugpy (#52091)

This commit is contained in:
Franck Nijhof 2021-06-22 21:16:50 +02:00 committed by GitHub
parent ba3416b724
commit b112b18848
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,7 +1,7 @@
"""The Remote Python Debugger integration.""" """The Remote Python Debugger integration."""
from __future__ import annotations from __future__ import annotations
from asyncio import Event, get_event_loop from asyncio import Event, get_running_loop
import logging import logging
from threading import Thread from threading import Thread
@ -44,7 +44,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
call: ServiceCall | None = None, *, wait: bool = True call: ServiceCall | None = None, *, wait: bool = True
) -> None: ) -> None:
"""Enable asyncio debugging and start the debugger.""" """Enable asyncio debugging and start the debugger."""
get_event_loop().set_debug(True) get_running_loop().set_debug(True)
debugpy.listen((conf[CONF_HOST], conf[CONF_PORT])) debugpy.listen((conf[CONF_HOST], conf[CONF_PORT]))