-
Notifications
You must be signed in to change notification settings - Fork 765
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
VS Code Python Issue: "Default Python Functions Not Defined" Error #5447
Comments
Can you please provide a log as described under "Filing an issue" in the troubleshooting guide? |
I have added it into the file output.txt |
This is weird. Any chance you have
|
no, i do not have typeshed installed. |
Edit 2/6/2024 7:31pm EST : I managed to fix the issue. I completely uninstalled VSCode and all associated files and settings. I redownloaded it and reinstalled my plugins and it works fine. I still have no idea what caused this issue, but if it happens to anyone else my only advice is to completely delete and reinstall vscode, deleting the following files as well before you reinstall. |
I'm keeping this open in hopes i can eventually repro |
Please reactivate if you get a repro. |
Hi Team, |
This seems to be reproducible by configuring something like
in VSCodes |
thank you for the repro. let us take a look whether we can guard from it. |
I encountered this issue working on a project in wsl2. The extension page presented with: After clicking to install in WSL and restarting VScode the Pylance lint errors for built-ins like Just sharing in case it helps to troubleshoot... |
I can't repro the original issue anymore. closing it. |
Description of the Problem:
I am experiencing an error in Visual Studio Code across all default Python functions (e.g., input(), print(), etc.). When trying to use these functions in a Python script, I receive errors stating that these functions are "not defined".
Operating System (macOS Monterey ver. 12.7.2):
Visual Studio Code Version (1.86.0):
Python Extension Version in VS Code (2024.0.1):
Python Version (Python 3.11.5, All Versions I have installed):
Any other relevant extensions or tools installed (if any):
I am using Anaconda3
I have no extensions other than the default Python, Python Debugger, and Pylance
Steps to Reproduce:
The script should execute without errors, and standard Python functions should work as expected. Pylance should not flag default Python functions as reportUndefinedVariable.
When running the script it executes normally and runs as normal, but VS Code flags errors for all standard Python functions, claiming they are "not defined". This is occurring despite these functions being integral parts of Python.
output.txt
Normal Hello World Script like as follows has the following problem, the function print is underlined in yellow.
print('Hello, World!')
In the problems tab the following error occurs
Additional Context:
The issue seems to be isolated to Visual Studio Code, I suspect it might be related to Pylance, Because when pylance is disabled the issue goes away. Other QOL enhancements do too, but the original issue also disappears. I would also like to add, I am pretty new to learning python and am not sure how this occurred, so I'm not exactly sure how to replicate this issue. If i end up finding a solution i will add it.
Edit 2/6/2024 7:31pm EST : I managed to fix the issue. I completely uninstalled VSCode and all associated files and settings. I redownloaded it and reinstalled my plugins and it works fine. I still have no idea what caused this issue, but if it happens to anyone else my only advice is to completely delete and reinstall vscode, deleting the following files as well before you reinstall.
~/.config/Code ~/Library/Application Support/Code ~/Library/Caches/com.microsoft.VSCode ~/Library/Caches/com.microsoft.VSCode.ShipIt ~/Library/Preferences/com.microsoft.VSCode.helper.plist ~/Library/Preferences/com.microsoft.VSCode.plist ~/Library/Saved Application State/com.microsoft.VSCode.savedState
The text was updated successfully, but these errors were encountered: