from pathlib import Path # Update dashboard/api/app.py file_path = Path("dashboard/api/app.py") content = file_path.read_text() old_line = ' nx_executable = r"C:\\Program Files\\Siemens\\NX2412\\NXBIN\\run_journal.exe"' new_lines = ''' # Import centralized NX paths try: import sys from pathlib import Path as P sys.path.insert(0, str(P(__file__).parent.parent.parent)) from config import NX_RUN_JOURNAL nx_executable = str(NX_RUN_JOURNAL) except ImportError: # Fallback if config not available nx_executable = r"C:\\Program Files\\Siemens\\NX2412\\NXBIN\\run_journal.exe"''' content = content.replace(old_line, new_lines) file_path.write_text(content) print("Updated dashboard/api/app.py") print() print("Configuration migration complete!") print("Test with: python config.py")