Skip to content

stream to interpreter instead of paths #21473

@CalianDos

Description

@CalianDos

I'd like to connect to a python interpreter running inside of a docker container instead of my host machine.

Did some initial experiments by making a script:

exec docker exec python_service python $@

And telling vscode that was my python interpreter. It failed at the first hurdle and by looking in the output I can see that this is due to the fact that the extension calls the python interpreter with file paths which of course don't exist in the container:

2023-06-21 19:34:43.194 [error] [Error: Command failed: /home/abrown/development/projects/dev-service/.vscode/dev-python -I /home/abrown/.vscode-server/extensions/ms-python.python-2023.10.1/pythonFiles/get_output_via_markers.py /home/abrown/.vscode-server/extensions/ms-python.python-2023.10.1/pythonFiles/interpreterInfo.py
python: can't open file '/home/abrown/.vscode-server/extensions/ms-python.python-2023.10.1/pythonFiles/get_output_via_markers.py': [Errno 2] No such file or directory

	at ChildProcess.exithandler (node:child_process:400:12)
	at ChildProcess.emit (node:events:513:28)
	at maybeClose (node:internal/child_process:1093:16)
	at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)] {
  code: 2,
  killed: false,
  signal: null,
  cmd: '/home/abrown/development/projects/dev-service/.vscode/dev-python -I /home/abrown/.vscode-server/extensions/ms-python.python-2023.10.1/pythonFiles/get_output_via_markers.py /home/abrown/.vscode-server/extensions/ms-python.python-2023.10.1/pythonFiles/interpreterInfo.py'
}

So I know it would be theoretically possible to pipe scripts into python instead of using those paths which would make it compatible with docker, but I understand that might be quite the undertaking. Am I totally out to lunch here? Or anyone have any other bright ideas?

Metadata

Metadata

Assignees

Labels

feature-requestRequest for new features or functionalitytriage-neededNeeds assignment to the proper sub-team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions