-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
How can I get Pylance to "assume" the version of Python I am running? #22191
Comments
Possibly, this is because I am Attaching VSCode to a Docker container. However, I would like the language server to attach to the same container as the terminal, please. |
Transferring to vscode-python since they own Python environment selection and tell us which environment/version is in use. |
@philosofool Can you share the Output > Python logs? it should say which one is selected. If you enable |
My partner used to say "you don't need to help me open the jar, the jar just needs to hear me ask you for help, and then it opens." It turns out I just needed to select the correct Python interpreter (Ctrl+Shft+P > Select Python Interpreter) and Pylance parsed the code using the selected version of Python. Thanks for your attention. |
The Python Langauge Server Output in VSCode reports "Assuming Python 3.8" but I would like it to detect the current version of Python or, at least, be configured to run with the version of Python that I am using.
Sample Output:
From terminal,
python --version
outputspython 3.9.10
. However, Pylance language server is "assuming Python 3.8" according to the Python Language Server output. I believe this is the cause of a Pylance false positive when type hinting with indexed classes, e.g.def flatten(list[list]):
I get an errorSubscript for class "list" will generate runtime exception; enclose type annotation in quotes
(Perhaps this isn't really a false positive, if it's using Python 3.8, which did not support that typing syntax, but I think you see my point.)The text was updated successfully, but these errors were encountered: