I have a new computer at work and I am setting up Visual Studio Code.
I write a simple function in the editor and send it to terminal, I get the following error:
IndentationError: unexpected indent
I tried to remove indentation in formula definition of editor, and it worked:
Is there something I can do to correct this issue, as it will wreak havoc on more complex functions and loops
EDIT:
according to https://github.com/microsoft/vscode-python/issues/24256, python 3.13 is buggy in vscode
moved to python 3.12, and it worked
This is a known CPython issue on Windows (it has nothing to do with Visual Studio Code): https://github.com/python/cpython/pull/124119
As a workaround, you can either switch back to Python 3.12, or use the “Native REPL” in Visual Studio Code, which is not affected by this issue.
0
Had a similar issue. Switching to 3.12 solved the indentation issue but produced a different error when I tried to re-run a line after I ran the full script.
Switching to the pre-release Python extension on VS Code (PR mentioned here: https://github.com/microsoft/vscode-python/issues/24256#issuecomment-2465711450) fixed everything!
According to https://github.com/microsoft/vscode-python/issues/24256, Python 3.13 is buggy in Visual Studio Code.
Moved to Python 3.12, and it worked.
0
There was an issue with the Python extension and Python 3.13. It should be fixed now circa VS Code 1.96.