简体   繁体   中英

how to configure the launch.json in VS code to accept a network path (python) in windows

I have been given the following network path to a python exe (in windows10 ):

\\eu\tac\conda\1.0\win\envs\dev\CURRENT\python.exe

Note the single and double \ 's in the above path.

i try to edit the launch.json in vscode to include this as follows:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        
        {
            "name": "Python: Current File",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "justMyCode": true
        },
        {
            "name": "Python: network (not working)",
            "type": "python",
            "request": "launch",
            "program": "\\eu\\tac\\conda\\1.0\\win\\envs\\dev\\CURRENT\\python.exe",
            "console": "integratedTerminal",
            "justMyCode": true

        }
    ]
}

However, i keep getting errors either referring to invalid syntax which presumably come from the \ and / variants that i have tried. Or a No such file or directory: 'H:\\eu\\tac\\conda\\1.0\\win\\envs\\dev\\CURRENT\\python.exe' error message as the terminal adds an H: prior to the program.

So the question is, how can i get vscode to recognise the path correctly ?

So what i have discovered is that the "program": "${file}" in the launch.json actually refers to the file to be run and not the executable file path.

Selecting the python executable file is done from the settings under default interpreter path and conda path (for conda).

by changing both of the above parameters to the exe file name (in this case) \\eu\tac\conda\1.0\win\envs\dev\CURRENT\python.exe seemed to point vscode to the correct python exe.

For clarity, is a picture of where and how: 在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM