Closed SamPosh closed 1 year ago
You can set the working directory via a cwd
property in the :h dap-configuration
. See also :help dap-python.DebugpyLaunchConfig
for a list of the options or https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings
And there's also a part in the readme about customizing the default configurations: https://github.com/mfussenegger/nvim-dap-python#custom-configuration
@mfussenegger sorry to open this back up again but if I am understanding correctly the configuration is global, right? Obviously, I want the working directory to be different from python project to python project so is there a way to configure it at the project level?
Thanks.
Edit:
So I tried making a .vscode/launch.json file
in the root directory of my project that looked like this:
{
"version": "0.2.0",
"configurations": [
{
"type": "python",
"request": "launch",
"name": "Launch",
"cwd": "/home/luca/Documents/Projects/Head_Hunter_9000"
}
]
}
And I put the following line in my ~/.config/nvim/after/plugin/dappython.lua
:
require('dap.ext.vscode').load_launchjs()
This did not seem to change my working directory. I feel like I am close though...
Okay I had to add "program": "${file}" to the configuration. Also feel like an idiot b.c. I wasn't using the write debug launcher... So everything is resolved.
In my python file I am opening a file , the file path contains my_tool/input.yaml
/workspaces |__ my_tool | tool.py | input.yaml
I opened the file in neovim and execute the tool.py
it fails as
Thread stopped due to exception of type FileNotFoundError
But if i change the filepath to 'input.yml' then it works. Seems like current working directory is set to file path. Can I modify the cwd? How to do it? Is there an option available for it?