{"record":{"id":"6b8c51374d46440f","repo":"pola-rs/polars","slug":"launch-py-is-not-meant-to-be-executed-directly-please-use","errorCode":null,"errorMessage":"launch.py is not meant to be executed directly; please use the `Python: Debug Rust` debugging configuration to run a python script that uses the polars library.","messagePattern":"launch\\.py is not meant to be executed directly; please use the `Python: Debug Rust` debugging configuration to run a python script that uses the polars library\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"py-polars/debug/launch.py","lineNumber":29,"sourceCode":"consistently, it is recommended to increase this value.\n\"\"\"\nLLDB_DEBUG_WAIT_TIME_SECONDS = 1\n\n\ndef launch_debugging() -> None:\n    \"\"\"\n    Debug Rust files via Python.\n\n    Determine the pID for the current debugging session, attach the Rust LLDB launcher,\n    and execute the originally-requested script.\n    \"\"\"\n    if len(sys.argv) == 1:\n        msg = (\n            \"launch.py is not meant to be executed directly; please use the `Python: \"\n            \"Debug Rust` debugging configuration to run a python script that uses the \"\n            \"polars library.\"\n        )\n        raise RuntimeError(msg)\n\n    # Get the current process ID.\n    pID = os.getpid()\n\n    # Print to the debug console to allow VSCode to pick up on the signal and start the\n    # Rust LLDB configuration automatically.\n    launch_file = Path(__file__).parents[2] / \".vscode/launch.json\"\n    if not launch_file.exists():\n        msg = f\"Cannot locate {launch_file}\"\n        raise RuntimeError(msg)\n    with launch_file.open(\"r\") as f:\n        launch_info = f.read()\n\n    # Overwrite the pid found in launch.json with the pid for the current process.\n    # Match the initial \"Rust LLDB\" definition with the pid defined immediately after.\n    pattern = re.compile('(\"Rust LLDB\",\\\\s*\"pid\":\\\\s*\")\\\\d+(\")')\n    found = pattern.search(launch_info)\n    if not found:","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/pola-rs/polars/blob/fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e/py-polars/debug/launch.py#L11-L47","documentation":"py-polars/debug/launch.py is a helper that lets VSCode attach an LLDB debugger to a Python process running polars. Running it directly (no script argument) raises this RuntimeError telling you to use the 'Python: Debug Rust' launch configuration instead.","triggerScenarios":"Executing `python launch.py` (or the debugpy adapter invoking it) without a target script in sys.argv.","commonSituations":"Running the file manually from a terminal to 'test' debugging; a misconfigured .vscode/launch.json that invokes launch.py without the 'module'/'args' pointing at a user script.","solutions":["Use the 'Python: Debug Rust' configuration in VSCode (F5) with your target python script, not `python launch.py` directly","Run the debug flow as described in the contributing guide: https://docs.pola.rs/development/contributing/ide/#debugging","If invoking programmatically, pass the python script to debug as an argument so len(sys.argv) > 1"],"exampleFix":"// before\npython py-polars/debug/launch.py\n// after\n# In VSCode: select 'Python: Debug Rust' configuration and press F5 with your script\npython py-polars/debug/launch.py my_script.py  # only if you must invoke manually","handlingStrategy":"type-guard","validationCode":"import sys\nif len(sys.argv) == 1:\n    raise SystemExit(\"Use the 'Python: Debug Rust' VSCode configuration instead of running launch.py directly\")","typeGuard":null,"tryCatchPattern":"try:\n    import launch  # or execfile\nexcept RuntimeError as e:\n    print(f'Debug helper misuse: {e}. Use the Python: Debug Rust configuration.')","preventionTips":["Always start polars Rust debugging via the VSCode 'Python: Debug Rust' configuration","Never invoke launch.py manually from the shell","Keep the contributing guide's debugging setup documented for the team"],"tags":["python","debugging","vscode","misuse"],"backgroundTag":"invalid-cli-argument","analyzedSha":"fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e","analyzedAt":"2026-09-18T22:14:11.667Z","contentChangedAt":"2026-09-18T22:14:11.667Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}