import os FILE = r"C:\Users\12914\Desktop\school-meal\run.py" with open(FILE, "r", encoding="utf-8") as f: content = f.read() # The setup_environment function has: sys.path.insert(0, base) # But base is the project root. The config module is in backend/. # In dev mode, we need to also add backend/ to sys.path. old = " sys.path.insert(0, base)\n os.environ.setdefault" new = " sys.path.insert(0, base)\n # In dev mode, add backend/ to path so config and meals are importable\n backend_dir = os.path.join(base, 'backend')\n if os.path.isdir(backend_dir) and backend_dir not in sys.path:\n sys.path.insert(0, backend_dir)\n os.environ.setdefault" if old in content: content = content.replace(old, new, 1) print("Fixed sys.path") else: print("Pattern not found") with open(FILE, "w", encoding="utf-8") as f: f.write(content) print("Done")