Skip to content

Jupyter interactive: run current cell throws IndentationError: unexpected indent #7303

@jaakko-paavola

Description

@jaakko-paavola

Environment data

  • VS Code version: 1.60.0-insider
  • Jupyter Extension version (available under the Extensions sidebar): v2021.8.2031165864
  • Python Extension version (available under the Extensions sidebar): v2021.9.1144093763
  • OS (Windows | Mac | Linux distro) and version: Windows (local), Amazon Linux 2 (remote)
  • Python and/or Anaconda version: Python 3.7.6, IPython 7.21.0
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): virtualenv
  • Jupyter server running: Remote

Expected behaviour

When running a cell marked with # %% in a .py file, the indentation level of the cell is the "base level" for all lines in the cell when sent to the interactive window.

Actual behaviour

kuva
"run current cell" results in
kuva
The first line is treated correctly:
kuva
results in
kuva
The indentation of # %% makes no difference:
kuva
results in
kuva

Steps to reproduce:

Logs

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable buginteractive-windowImpacts interactive windowverifiedVerification succeeded

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions