microsoft / microsoft/vscode-python-debugger

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

Đang mở
#614 3 bình luận 0 reaction 1 người được giao Xem trên GitHub

@eleanorjboyd đang làm issue này rồi.

Từ ngày 18/2/2025.

triage-needed
Ngôn ngữ chính
TypeScript
Star
181
Fork
126
Merge trung bình
2 ngày 3 giờ
Pull request đã merge (30 ngày)
3

Mô tả

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


Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.