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

Fail to debug a python project #4209

Open
v-ruizh opened this issue Jan 18, 2024 · 7 comments · Fixed by #4223
Open

Fail to debug a python project #4209

v-ruizh opened this issue Jan 18, 2024 · 7 comments · Fixed by #4223

Comments

@v-ruizh
Copy link

v-ruizh commented Jan 18, 2024

OS: Win 10
Build Version: 20240117.1

Repro Steps:

  1. Open a python project myapp.zip in VS Code Insiders.
  2. F1 -> Docker: Add Docker Files to Workspace -> Python: General -> Include docker compose files.
  3. Debug this project.
  4. Check whether succeeds to debug the python project or not.

Expect:
Succeed to debug the python project.

Actual:
Fail to debug the python project with an error.
image

More Info:

  1. This issue also reproduces for Django or Flask project.
  2. This is the launch.json file.
    image
@bwateratmsft
Copy link
Collaborator

I am not able to reproduce on a Win11 machine. @v-ruizh does this happen consistently on more than one machine?

@bwateratmsft
Copy link
Collaborator

I was able to reproduce in VSCode Insiders. I'll investigate and see what I can figure out.

@v-ruizh
Copy link
Author

v-ruizh commented Feb 4, 2024

Verified this issue on Docker extension 20240202.4, it does not reproduce on Windows platform. But it still reproduces on Mac and Linux platforms.

@bwateratmsft
Copy link
Collaborator

I've found that what's happening is the Python extension is validating that the Python executable is valid, but the Python command we are giving is the one to launch in the container, however they're validating against the host. I don't know why this is only happening in Insiders.

I've noticed that on my system at least, python refers to Python 3, and python3 results in a Windows Store page opening up, so if our debug configuration resolves python3 it fails.

However, in my WSL instance, python does not work by default, and python3 is the only valid command.

This is a problem--this forces the user to have python locally and inside the container and on the PATH environment variable, which is not helpful.

@bwateratmsft
Copy link
Collaborator

@v-ruizh Can you share the results from the following commands on Windows, Mac, and Linux?

python
python3

On my Windows device, python launches the Python interpreter, but python3 opens a Windows Store page.

In my Linux WSL instance and on my Macbook, python is not found and python3 launches the Python interpreter.

@v-ruizh
Copy link
Author

v-ruizh commented Feb 6, 2024

@bwateratmsft We have the same results.

On my Windows device, python launches the Python interpreter, but python3 opens a Windows Store page.
image

On my Mac and Ubuntu22.04, python is not found and python3 launches the Python interpreter.
image

@bwateratmsft
Copy link
Collaborator

Blocked on microsoft/vscode-python-debugger#531

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