error message if console is running

This commit is contained in:
Will McGugan
2022-10-22 08:56:17 +01:00
parent 899b4156f6
commit 80394a69b8

View File

@@ -43,7 +43,16 @@ def _run_devtools(verbose: bool, exclude: list[str] | None = None) -> None:
def noop_print(_: str):
return None
run_app(app, port=DEVTOOLS_PORT, print=noop_print, loop=asyncio.get_event_loop())
try:
run_app(
app, port=DEVTOOLS_PORT, print=noop_print, loop=asyncio.get_event_loop()
)
except OSError:
from rich import print
print()
print("[bold red]Couldn't start server")
print("Is there another instance of [reverse]textual devtools[/] running?")
def _make_devtools_aiohttp_app(