Spaces:
Sleeping
Sleeping
Raymond Weitekamp commited on
Commit ·
270241f
1
Parent(s): 9a6fd7c
Fix ocp_vscode lock directory handling by setting environment variable before imports
Browse files- cadviewer.py +9 -9
cadviewer.py
CHANGED
|
@@ -33,22 +33,23 @@ license:
|
|
| 33 |
|
| 34 |
"""
|
| 35 |
|
|
|
|
| 36 |
import os
|
|
|
|
|
|
|
| 37 |
import logging
|
| 38 |
|
| 39 |
# Configure logging
|
| 40 |
logging.basicConfig(level=logging.INFO)
|
| 41 |
logger = logging.getLogger(__name__)
|
| 42 |
|
| 43 |
-
#
|
| 44 |
-
|
| 45 |
-
os.environ['OCP_VSCODE_LOCK_DIR'] = lock_dir
|
| 46 |
-
logger.info(f"Using lock directory: {lock_dir}")
|
| 47 |
logger.info(f"Current working directory: {os.getcwd()}")
|
| 48 |
-
logger.info(f"Directory contents of lock dir parent: {os.listdir(os.path.dirname(
|
| 49 |
-
logger.info(f"Lock dir exists: {os.path.exists(
|
| 50 |
-
if os.path.exists(
|
| 51 |
-
logger.info(f"Lock dir permissions: {oct(os.stat(
|
| 52 |
|
| 53 |
from nicegui import app, ui
|
| 54 |
from nicegui.events import KeyEventArguments
|
|
@@ -70,7 +71,6 @@ def startup_all():
|
|
| 70 |
logger.info("Starting ocp_vscode subprocess")
|
| 71 |
# spawn separate viewer process
|
| 72 |
env = os.environ.copy() # Copy current environment
|
| 73 |
-
env['OCP_VSCODE_LOCK_DIR'] = env.get('OCP_VSCODE_LOCK_DIR', '/tmp/ocpvscode') # Use env var or default
|
| 74 |
logger.info(f"Subprocess environment OCP_VSCODE_LOCK_DIR: {env['OCP_VSCODE_LOCK_DIR']}")
|
| 75 |
ocpcv_proc = subprocess.Popen(["python", "-m", "ocp_vscode", "--host", "0.0.0.0"], env=env)
|
| 76 |
logger.info("ocp_vscode subprocess started")
|
|
|
|
| 33 |
|
| 34 |
"""
|
| 35 |
|
| 36 |
+
# Set environment variable before any imports
|
| 37 |
import os
|
| 38 |
+
os.environ['OCP_VSCODE_LOCK_DIR'] = '/tmp/ocpvscode'
|
| 39 |
+
|
| 40 |
import logging
|
| 41 |
|
| 42 |
# Configure logging
|
| 43 |
logging.basicConfig(level=logging.INFO)
|
| 44 |
logger = logging.getLogger(__name__)
|
| 45 |
|
| 46 |
+
# Log environment setup
|
| 47 |
+
logger.info(f"Using lock directory: {os.environ['OCP_VSCODE_LOCK_DIR']}")
|
|
|
|
|
|
|
| 48 |
logger.info(f"Current working directory: {os.getcwd()}")
|
| 49 |
+
logger.info(f"Directory contents of lock dir parent: {os.listdir(os.path.dirname(os.environ['OCP_VSCODE_LOCK_DIR']))}")
|
| 50 |
+
logger.info(f"Lock dir exists: {os.path.exists(os.environ['OCP_VSCODE_LOCK_DIR'])}")
|
| 51 |
+
if os.path.exists(os.environ['OCP_VSCODE_LOCK_DIR']):
|
| 52 |
+
logger.info(f"Lock dir permissions: {oct(os.stat(os.environ['OCP_VSCODE_LOCK_DIR']).st_mode)[-3:]}")
|
| 53 |
|
| 54 |
from nicegui import app, ui
|
| 55 |
from nicegui.events import KeyEventArguments
|
|
|
|
| 71 |
logger.info("Starting ocp_vscode subprocess")
|
| 72 |
# spawn separate viewer process
|
| 73 |
env = os.environ.copy() # Copy current environment
|
|
|
|
| 74 |
logger.info(f"Subprocess environment OCP_VSCODE_LOCK_DIR: {env['OCP_VSCODE_LOCK_DIR']}")
|
| 75 |
ocpcv_proc = subprocess.Popen(["python", "-m", "ocp_vscode", "--host", "0.0.0.0"], env=env)
|
| 76 |
logger.info("ocp_vscode subprocess started")
|