microsoft / microsoft/vscode-python-debugger
"Run Python File" returned an error but "Run Python File in Dedicated Terminal" could run successfully.
Open
@eleanorjboyd is already working on this.
Since Feb 18, 2025.
triage-needed
- Dominant language
- TypeScript
- Stars
- 181
- Forks
- 126
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 3
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.