From 48aff4874057289fe424ca0e4dbcb5a7279df04b Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Sun, 14 Jun 2020 08:11:56 +0200 Subject: [PATCH] logfile sanity check --- WebHost/__init__.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/WebHost/__init__.py b/WebHost/__init__.py index 3ebd3283..0465344b 100644 --- a/WebHost/__init__.py +++ b/WebHost/__init__.py @@ -86,8 +86,11 @@ def upload_multidata(): def _read_log(path: str): - with open(path) as log: - yield from log + if os.path.exists(path): + with open(path) as log: + yield from log + else: + yield "Logfile does not exist. Likely a crash during spinup of multiworld instance." @app.route('/log/') @@ -140,8 +143,7 @@ def run_server_process(multidata: str): if ".." not in sys.path: sys.path.append("..") from MultiServer import Context, server - loop = asyncio.get_event_loop() - loop.run_until_complete(main()) + asyncio.run(main()) if __name__ == "__main__":