I have been all over the internet and spent hours trying to fix this. It may be something pretty straight forward so please cut me some slack. This is my first time using Visual Studio Code. I have already tried the solutions presented in the links below:
- VS Code - pylinter cannot find module
- vscode import error for python module
- Can't get VSCode/Python debugger to find my project modules
- https://code.visualstudio.com/docs/python/environments
My folder structure looks like this:
I am trying to run the urls.py file which tries to import the views file using-
from . import views
But I get the following error:
Traceback (most recent call last): File "c:/Users/abc/projects/telusko/calc/urls.py", line 7, in from . import views ImportError: cannot import name 'views'
I have tried all possible combinations, and currently my launch.json file looks like this:
{
// 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"
}],
"env": {"PYTHONPATH": "c:/Users/abc/projects/telusko/"},
"python.pythonPath": "c:/Users/abc/Envs/test/Scripts/python.exe"
}
I am using a virtual env to run this project, the env is located at - "c:/Users/abc/projects/telusko/test/"
And my project directory is located at -
"c:/Users/abc/projects/telusko/"