first no results, then "IndentationError: unexpected indent" when starting commands with an indented block with shift+Enter
See original GitHub issueEnvironment data
Version: 1.46.1 (user setup) Commit: cd9ea6488829f560dc949a8b2fb789f3cdc05f5d Date: 2020-06-17T21:16:50.293Z Electron: 7.3.1 Chrome: 78.0.3904.130 Node.js: 12.8.1 V8: 7.8.279.23-electron.0 OS: Windows_NT ia32 10.0.18363
- Python version (& distribution if applicable, e.g. Anaconda): Python 3.8.3
- Type of virtual environment used (N/A | venv | virtualenv | conda | …): None
- Relevant/affected Python packages and their versions: all
- Relevant/affected Python-related VS Code extensions and their versions: all
- Value of the
python.languageServer
setting: Microsoft
Expected behaviour
if True:
print('Hello')
–> Hello
Actual behaviour
>>> if True:
... print('Hello')
... if True:
File "<stdin>", line 3
if True:
^
SyntaxError: invalid syntax
>>> print('Hello')
File "<stdin>", line 1
print('Hello')
^
IndentationError: unexpected indent
>>>
running only the isolated print('Hello')
line without the if True
prints the expected “Hello”, regardless of the indentation.
Steps to reproduce:
- run
if True:
print('Hello')
- run
if True:
print('Hello')
- / 4. you could repeat it, it would always give you just a print of your command at first, and at the second time it will give you IndentationError again.
To make this clear: I cannot run any indented code at all, whatever the example. Any line that is not indented inside a parent command can be run, and any line that I select as a single line can be run regardless of its indentation.
This error still occurs after using the repair function of Python 3.8.3 installation file.
This error does not occur when using the Python ide of Python 3.8.3 in command prompt --> python.exe.
I have already switched vscode settings between 4 spaces and tab indentation, and I have replaced tabs with 4 spaces in the whole file and back. Of course I have also restarted many times and I have opened completely new py files to check it again. I have also installed vscode over the current vscode installation, no change. Then I have uninstalled vscode and installed it again, no change. Then I have uninstalled both vscode and Python, restarted, and installed both again, no change.
probably linked with https://github.com/microsoft/vscode/issues/61092
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:10 (3 by maintainers)
Hi @karrtikr, I have tested this, there is no issue anymore.
Hi, is this still an issue with the latest version of the extension?