I write a minimum demo flask app in vscode:
from flask import Flask
app = Flask(__name__)
@app.route('/')
def index():
return "Hello World!"
When I run it in vscode, it give me an error:
Error: Could not import "D".
The problem is I don't import any "D" packages, so I have no idea where this error come from and how to debug it.
I try to run this app in powershell, and it works as expected. So I think there may be some problem in my personal configurations of vscode. Below is my launch.json file of this project:
{
"name": "Python: Flask (0.11.x or later)",
"type": "python",
"request": "launch",
"module": "flask",
"env": {
"FLASK_APP": "${workspaceFolder}/hello.py"
},
"args": [
"run",
"--no-debugger",
"--no-reload"
]
}
My user settings:
{
"workbench.startupEditor": "newUntitledFile",
"explorer.confirmDelete": false,
"git.enableSmartCommit": true
}
My workspace settings:
{
"python.pythonPath": "${workspaceRoot}/venv/Scripts/python.exe",
"python.formatting.provider": "yapf",
}
Thanks in advance for Any suggestions on where the problem is or how to debug it.