Closed avnotaklu closed 2 years ago
just tried running :CocLocalConfig and specifying python path in local coc-settings.json it worked. However pythonPath in global coc-settings.json still doesn't work.
Workspace: /home/ssp/python/imageDownload/pexels Using python from /home/ssp/python/django/CHANNELS_BACKUP/chat/env/bin/python
coc-pyright will try to detect the Python bin from your project root, here is /home/ssp/python/imageDownload/pexels
, do you have anything like in your root:
.python-version
filePipfile
filepoetry.lock
pyvenv.cfg
filecoc-pyright will try to detect the Python bin from your project root, here is
/home/ssp/python/imageDownload/pexels
, do you have anything like in your root:
.python-version
file
Pipfile
file
poetry.lock
any venv folder that contains
pyvenv.cfg
file
No, these files don't exist in this folder
Pyright gives this behavior for every file inside /home/ssp/python
and its every subdirectory except the ones that have virtual env, None of those directories have any of these files and the only folders that contain pyvenv.cfg are inside ~/python/django
For directories other than ~/python
it uses same path as that of which python
. Is this intended behavior because pyright still doesn't respect python.pythonPath
setting?
I just looked and there was local coc config with that python path in ~/python
. It was causing all the trouble. It's using correct path now after i deleted that config.
Thanks for the help.
CocCommand pyright.version : 1.1.164 Platform : Ubuntu 20.04.2
Pyright doesn't use python.pythonPath when no virtual env is available instead it uses python from some other environment (Which doesn't even exist now, i deleted it a while ago ). Using pyrightconfig.json i can specify virtual env but default python path doesn't work( Pyright doesn't find modules and says
[Pyright reportMissingModuleSource] [W] Import "requests" could not be resolved from source
), It also jumps to fallbackStubs when i jump to definition( even modules like os ) which i guess is expected as the directory it says it finds python in doesn't even exist.CocCommand workspace.showOutput Pyright
Also even though virtual environments work (I think so because Pyright detects modules jumps to definition etc) when i don't run from root of the project;
CocCommand workspace.showOuput
says that Pyright uses python from another environment. Probably there is some bug inworkspace.showOutput
CocCommand, I that case is there any other way to know what python path pyright is using.showOutput
gives correct output when running vim from project root .showOuput
using virtual env and when i don't run from root.CocConfig