import os path = "/root/autodl-tmp/SplatAtlas/scripts/phase1_validation/render_single.py" with open(path, "r") as f: code = f.read() old_str = 'is_synthetic = os.path.exists(os.path.join(source_path, "transforms_test.json"))' new_str = 'is_synthetic = os.path.exists(os.path.join(source_path, "transforms_test.json")) and not os.path.exists(os.path.join(source_path, "sparse"))' if old_str in code: code = code.replace(old_str, new_str) with open(path, "w") as f: f.write(code) print("[Patch Applied] render_single.py routing logic hardened (sparse check added).") else: print("[Patch Skipped] old routing string not found.")