From 51463ab67439e380be15698cfee14a69b33bd7da Mon Sep 17 00:00:00 2001 From: Ziad-I <68874104+Ziad-I@users.noreply.github.com> Date: Tue, 30 Jul 2024 18:18:35 +0300 Subject: [PATCH] fix pid file not there on first run so exception was thrown and not caught when the user ran the web ui for the first time. the running_pid file was not created yet by the server so it threw an exception due to with open not inside the try block --- src/blenderbim/blenderbim/tool/web.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/blenderbim/blenderbim/tool/web.py b/src/blenderbim/blenderbim/tool/web.py index b5161e2d68..4c836cb6c8 100644 --- a/src/blenderbim/blenderbim/tool/web.py +++ b/src/blenderbim/blenderbim/tool/web.py @@ -227,13 +227,13 @@ class Web(blenderbim.core.tool.Web): return False webui_path = os.path.join(bpy.context.scene.BIMProperties.data_dir, "webui") pid_file = os.path.join(webui_path, "running_pid.json") - with open(pid_file, "r") as f: - try: + try: + with open(pid_file, "r") as f: data = json.load(f) if port in data.values(): return True - except: - pass + except: + pass time.sleep(0.1) @classmethod