Skip to content
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

IndentationError Running Loops #24761

Closed
therealsmithy opened this issue Jan 28, 2025 · 10 comments
Closed

IndentationError Running Loops #24761

therealsmithy opened this issue Jan 28, 2025 · 10 comments
Assignees
Labels
area-repl area-terminal bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster

Comments

@therealsmithy
Copy link

Type: Bug

While trying to run a for loop in python, I am recieving an IndentationError: unexpected indent. I have confirmed that my code works in other IDE's, so it is not a code issue.

VS Code version: Code 1.96.4 (cd4ee3b1c348a13bafd8f9ad8060705f6d4b9cba, 2025-01-16T00:16:19.038Z)
OS version: Windows_NT x64 10.0.22631
Modes:

System Info
Item Value
CPUs Intel(R) Core(TM) Ultra 9 185H (22 x 3072)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 31.68GB (15.73GB free)
Process Argv --crash-reporter-id 5e14b006-8ae5-4bb7-ad72-111394fab168
Screen Reader no
VM 0%
Extensions (11)
Extension Author (truncated) Version
copilot Git 1.260.0
copilot-chat Git 0.23.2
debugpy ms- 2024.14.0
python ms- 2024.22.2
vscode-pylance ms- 2024.12.1
jupyter ms- 2024.11.0
jupyter-keymap ms- 1.1.2
jupyter-renderers ms- 1.0.21
vscode-jupyter-cell-tags ms- 0.1.9
vscode-jupyter-slideshow ms- 0.1.6
quarto qua 1.118.0

(1 theme extensions excluded)

A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
pythonvspyt551:31179978
vscod805:30301674
binariesv615:30325510
vsaa593:30376534
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
2i9eh265:30646982
962ge761:30959799
pythonnoceb:30805159
pythonmypyd1:30879173
h48ei257:31000450
pythontbext0:30879054
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
dsvsc021:30996838
dvdeprecation:31068756
dwnewjupyter:31046869
nativerepl2:31139839
pythonrstrctxt:31112756
nativeloc1:31192215
cf971741:31144450
iacca1:31171482
5fd0e150:31155592
dwcopilot:31170013
stablechunks:31184530
6074i472:31201624
dwoutputs:31217127
9064b325:31222308
copilot_t_ci:31222730

@therealsmithy
Copy link
Author

therealsmithy commented Jan 28, 2025

Further clarification. This occurs when I write a loop with more than one argument after it.
Something like this runs fine:

for i in range (1,10):
    print(i)

While something like this does not

while i < 7:
    print(i)
    i += 1

@vs-code-engineering vs-code-engineering bot added the triage-needed Needs assignment to the proper sub-team label Jan 28, 2025
@benibenj benibenj assigned karthiknadig and unassigned benibenj Jan 29, 2025
@benibenj benibenj removed the triage-needed Needs assignment to the proper sub-team label Jan 29, 2025
@karthiknadig
Copy link
Member

@therealsmithy Are you using run in terminal or something equivalent?

@therealsmithy
Copy link
Author

I am using run in terminal. When I run in the Python REPL there is no problem.

@karthiknadig karthiknadig removed their assignment Jan 30, 2025
@karthiknadig karthiknadig transferred this issue from microsoft/vscode Jan 30, 2025
@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Jan 30, 2025
@anthonykim1
Copy link

Thanks for filing this @therealsmithy

Which Python version are you running?
Also do you have the setting on for smart send?

@anthonykim1 anthonykim1 added area-repl bug Issue identified by VS Code Team member as probable bug and removed triage-needed Needs assignment to the proper sub-team labels Jan 30, 2025
@github-actions github-actions bot added the info-needed Issue requires more information from poster label Jan 30, 2025
@anthonykim1
Copy link

Screenshot of your editor with code and the terminal should help alot :) Thanks

@anthonykim1
Copy link

If you are using Python3.13 on Windows, then I would've said its highly likely related to: #24256 (comment) coming from python/cpython#124096.

I'm hesitant because you say "I have confirmed that my code works in other IDE's, so it is not a code issue."

Are you sure your other IDEs are using Python3.13 (if you are seeing this error on VS Code with Python version >=3.13) and have you tried to use external terminal (such as pwsh) and see if you get similar results?

@therealsmithy
Copy link
Author

Image
Hello! Here is a screenshot. My other IDEs are also using Python 3.13.1.

@therealsmithy
Copy link
Author

therealsmithy commented Jan 30, 2025

I am using 3.13.1 and I am using smart send. Even when I change my Python version to 3.12.8 I run into the same error.

@anthonykim1
Copy link

I see, for your 3.13 issue it looks like its from what I have mentioned previously.

Could you just please double check if you are getting the same error even when you change to 3.12?
The screenshot only shows for 3.13

@therealsmithy
Copy link
Author

3.12 actually works just fine. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-repl area-terminal bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

4 participants