I'm working on a project which is structured like
Parent Directory
----+ MyPackage
----__init__.py
----file1.py
----+ Tests
----test.py
When I run the tests from terminal, I use
PYTHONATH=./ python ./Tests/test.py
Now, when I try the debug option after installing 'Python Extension', error is raised
Exception has occurred: ModuleNotFoundError
No module names 'MyPackage'
How can I put PYTHONPATH to the debug configuration such that it will taken care?
After some search and trial and error, I found something that works. I'm posting it here so that people looking for the same problem can also try. I'm not sure whether this is the right way to do t.
Create (or add to) a file .vscode/settings.json
the contents as
{
// .. any other settings
"terminal.integrated.env.linux": {
"PYTHONPATH": "${workspaceFolder}"
}
}
Now I'm able to run my project with the package.