

If omitted, defaults to $ (the folder open in VS Code). Use cwd to Specifies the current working directory for the debugger, which is the base folder for any relative paths used in code. The better way is to customize Settings.json and launch.json, do like this: // vi. The PYTHONPATH is the path to Python interpreter, not the working directory. Under the Pylance options you should see Extra Paths, this is where you set your source folder. Go to File > Preferences > Settings, search for pythonpath.


It also looks for common source folder names like src by default, this option is called. If you are using the Pylance extension you can set your source folder via the option. your_repo/service/.env.įor more details, see documentation on environment variable definition files.įor me this worked without restarting VSC, perhaps this is a matter of newer VSC and extensions versions. your_repo/.env.Īlso creating the file under the folder where your consuming code is, instead of under repo root, seems to work e.g. (You may need to restart VSCode for it to take PYTHONPATH into account correctly.)Ĭreate a file named. That will add your server folder to PYTHONPATH as needed.

vscode/settings.json for editing.You can create a. Selecting that option will create and open your project's. In VSCode's View menu, select Command Palette and search for Preferences: Open Workspace Settings (JSON). Point Visual Studio Code to the right Python interpreter If you prefer, the installation can also be done, faster, from command line - just run. Look for an extension called Python with the identifier ms-python.python install and enable it. In VSCode, go to File > Preferences > Extensions. Install the Visual Studio Code Python plugin
