microsoft / microsoft/vscode-python-environments

IndentationError when executing nested for-loops via “Run Selection/Line in Python Terminal”

オープン
#1,421 コメント 1 件 リアクション 0 件 担当者 1 名 @anthonykim1 が担当を希望しています GitHub で見る
*out-of-scope
主要言語
TypeScript
スター
138
フォーク
62
平均マージ
1日 4時間
マージ済み PR(30日)
35

説明

Type: Bug

My script contains nested for loop structures. When executing the code line by line or cell by cell using the “Run Selection/Line in Python Terminal” feature in VS Code, it consistently raises an "IndentationError: unexpected indent".

Notably, this issue only started occurring after a recent update. Prior to the update, the same code and workflow executed without any errors.

I have tried the following solutions suggested on the VS Code forum, but the issue is still here:

Try install [https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-python-envs]
(https://url.au.m.mimecastprotect.com/s/lDwtC1WLjwsM2mD1XcLfnTVY9Qt?domain=marketplace.visualstudio.com)
- The Python environment has been installed.

Can you update Python extension, Python environment extension to latest and see if you can still repro?
Also add "python.useEnvironmentsExtension": true, to your settings.json.
- Python environment extension has been updated to the latest version. The "python.useEnvironmentsExtension": true has also been set in the settings.json.

However, the problem is still here after doing these.

VS Code version: Code 1.113.0 (Universal) (https://github.com/microsoft/vscode/commit/cfbea10c5ffb233ea9177d34726e6056e89913dc, 2026-03-24T15:07:18+01:00)
OS version: Darwin arm64 25.3.0
Modes:
System Info
Item | Value
-- | --
CPUs | Apple M1 Pro (8 x 2400)
GPU Status | 2d_canvas: enabledGPU0: VENDOR= 0x106b [Google Inc. (Apple)], DEVICE=0x0000 [ANGLE (Apple, ANGLE Metal Renderer: Apple M1 Pro, Version 26.3 (Build 25D125))], DRIVER_VENDOR=Apple, DRIVER_VERSION=26.3 ACTIVEMachine model name: MacBookProMachine model version: 18.3direct_rendering_display_compositor: disabled_off_okgpu_compositing: enabledmultiple_raster_threads: enabled_onopengl: enabled_onrasterization: enabledraw_draw: disabled_off_okskia_graphite: enabled_ontrees_in_viz: disabled_offvideo_decode: enabledvideo_encode: enabledwebgl: enabledwebgl2: enabledwebgpu: enabledwebnn: disabled_off
Load (avg) | 9, 9, 8
Memory (System) | 16.00GB (0.13GB free)
Process Argv | --crash-reporter-id 4ab29e73-b8f7-417a-a1ff-18cf979f4bc3
Screen Reader | no
VM | 0%

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。