Import "flask" Could Not Be Resolved From Sourcepylancereportmissingmodulesource
Appreciate that this has been asked before, but I have tried the suggestions to no avail. a snip of flask not loading, with pip show flask output VSCode is telling me that: Import
Solution 1:
You need to add your current working directory to the python search path. This can be done with an environment variable:
export PYTHONPATH=.
Alternatively you can do it from within Python. I usually put this in my conftest.py
file in my tests folder, which is executed when pytest starts up.
import sys
from pathlib import Path
path = Path(__file__).parent.parent # i.e. the folder above the tests folder, which has app
sys.path.append(path)
The VS Code error is a separate issue. It sounds like you might not have the correct Python environment selected. See https://code.visualstudio.com/docs/python/environments
Post a Comment for "Import "flask" Could Not Be Resolved From Sourcepylancereportmissingmodulesource"