-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pyright doesn't use local platform if no python interpreter is specified #858
Comments
Ok, so this might be related to #697. What was happening was that in my 'working' case I had a left-over
With that file in place Pyright correctly picked up the system Python interpreter. If I remove that settings file my simple case also starts generating the same error. If I look into Pyright's settings I can see that the
If I manually change that setting to |
It looks like When Pyright is performing its analysis, it assumes that the value of You can override this default by providing a pyrightconfig.json file. Here is a sample config file that demonstrates how to specify the Linux platform. |
Yes, I should have updated the description. The problem is that I am running VSCode on Linux and the system default interpreter is |
Hmm, I don't see any reason why the selected interpreter would affect this. The default platform is determined by the platform that VS Code is running on (as indicated by node). And the type information comes from the bundled typeshed stub files regardless of what interpreter is selected. By any chance, do you have a pythonconfig.json or mspythonconfig.json file that defines different execution environments, some of which specify different pythonPlatform values? |
As far as I can tell I have none of those files on my system:
(if I'm looking in the wrong places please let me know) I've recorded a short video showing the problem occurring: https://www.youtube.com/watch?v=heT0-Efw5Nk |
I think I've figured out the root cause of this problem. I've introduced a fix, which will be in the next release of Pyright. |
This is addressed in Pyright 1.1.56, which I just published. It will also be in the next version of Pylance. |
Before I describe the problem: I can only reproduce this with some code that I can not post in full. Trying to reproduce this separately doesn't trigger the same error.
I have code that looks something like this:
This causes the following error:
(
_select.EPOLLOUT
generates the same error)I tried reproducing the error with a simpler example but I couldn't. For example, the following code does not trigger the problem:
Trying to figure out what is causing this I noticed the following: if I ctrl+click on
_select
I can see thatsys.platform
is being detected differently in the Typeshed code, which causesepoll
to not appear as a symbol in my first case:In this screenshot I have the problematic project on the left and the simple example on the right. Hovering
sys.platform
I get the following:I am using version 1.1.54 of the VSCode extension. The OS is Linux. No virtual environment. The default system Python version is 3.8.4.
The text was updated successfully, but these errors were encountered: