Quantcast
Channel: Active questions tagged visual-studio-code - Stack Overflow
Viewing all articles
Browse latest Browse all 97371

Python Intellisense VSCode Wrong Autocomplete Imports & PyLint wrong impor-error warning

$
0
0

My current app structure is:

backend
  -- api
    |-- migrations
    |-- app
    |   -- main
    |      -- routes.py
    |   -- modules
    |      -- Mod1
    |         -- helper.py
    |         -- controller.py
    |      -- Mod2
    |         -- helper.py
    |         -- controller.py
    |-- venv
    |-- application.py

My settings (saved in .vscode within the backend folder):

"python.pythonPath": "${workspaceFolder}/api/venv/bin/python3",
    "python.envFile": "${workspaceFolder}/api/.env",
    "python.venvPath": "${workspaceFolder}/api/venv/bin/python3",

If I try to import a module, I would normally do from app.modules.mod1 import controller. But VSCode Intellisense keeps correcting me to from api.app.modules... - which doesn't work (Flask gives me an Import Error).

Pylint also keeps telling me that my imports are wrong, even though my app runs fine. I adjusted the pylint-path as per this answer, but still gives me the same error.

I also lost the ability to "navigate" my code - I can't hold Cmd and click a function. Any ideas on what I might me doing wrong? It's a tremendous lost in productivity to miss the autocomplete and function links...


Viewing all articles
Browse latest Browse all 97371

Trending Articles