Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debugging script running in embedded interpreter via remote attach not working without PYDEVD_LOAD_NATIVE_LIB=0 #274

Open
emonette123 opened this issue Feb 20, 2024 · 0 comments

Comments

@emonette123
Copy link

This relates to debugging scripts running in embedded interpreters. In my experience, breakpoints will not be hit if you use the standard approach in VS Code, ie, have a script running in the embedded interpreter having this:

if not debugpy.is_client_connected():
    debugpy.configure(python=r"D:\NXOpen\sandbox\training\py\setup\.venv\nx2312\Scripts\python.exe")
    debugpy.listen(5678)
    print("Waiting for debugger to attach...")
    debugpy.wait_for_client()

debugpy.breakpoint()
to_listing_window("One line")

Run the script in the embedded interpreter, start debugging with VS Code remote attach. The script will exit the debugpy.wait_for_client() call, but it will then run to completion, without breaking.

If you define the weird environment variable PYDEVD_LOAD_NATIVE_LIB=0, it works properly. For both programmatic breakpoints and breakpoints set in VS Code.

To me, this should be part of the configuration as I always have a hard time finding back the information about that magical environment variable, which only job seems to not spawn tracing over all threads.

Can you add a configuration key like using_embedded_interpreter and just behave as if PYDEVD_LOAD_NATIVE_LIB=0 was set in the environment? This key should also enforce people to define the python key in the configuration because if you do not, the debugger will launch another instance of the app embedding the interpreter (sys.executable is NOT python when using an embedded interpreter).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant