microsoft / microsoft/vscode-python-debugger

"Run Python File" returned an error but "Run Python File in Dedicated Terminal" could run successfully.

Offen
#614 3 Kommentare 0 Reaktionen 1 zugewiesene Person Auf GitHub ansehen

@eleanorjboyd arbeitet bereits daran.

Seit 18.2.2025.

triage-needed
Vorherrschende Sprache
TypeScript
Sterne
181
Forks
126
Ø Merge
2 T. 3 Std.
Gemergte PRs (30 T.)
3

Beschreibung

x = 3
while x > 0:
    x -= 1
    print(x)

I run the above code with Run Python File in vscode and it returned an error:

>>> D:/Python313/python.exe c:/Users/colin/Desktop/PracticeAI/PracticeAI.py
  File "<python-input-7>", line 1
    D:/Python313/python.exe c:/Users/colin/Desktop/PracticeAI/PracticeAI.py
      ^
SyntaxError: invalid syntax

When I use Run Selection/Line in Python Terminal, it also returned an error:

>>> x = 3
>>> while x > 0:
...                 x -= 1
...                     print(x)
... 
  File "<python-input-9>", line 3
    print(x)
IndentationError: unexpected indent

But when I use Run Python File in Dedicated Terminal, it could run smoothly.

C:\Users\colin\Desktop\PracticeAI>D:/Python313/python.exe c:/Users/colin/Desktop/PracticeAI/PracticeAI.py
2
1
0


Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.