[Python] My VS Code terminal is acting weird - can't get it to execute code properly

Discussão em 'Python' iniciado por Stack, Abril 26, 2025.

  1. Stack

    Stack Membro Participativo

    I use VS Code. When I try to run my code, I get this error:

    >>> & "C:/Users/David Wang/AppData/Local/Microsoft/WindowsApps/python3.11.exe" "c:/Users/David Wang/Downloads/Python Grind/practice.py"
    File "<stdin>", line 1
    & "C:/Users/David Wang/AppData/Local/Microsoft/WindowsApps/python3.11.exe" "c:/Users/David Wang/Downloads/Python Grind/practice.py"
    ^
    SyntaxError: invalid syntax


    If I close the terminal and then run the code again, it will work. But if I delete the code and write up some new stuff, it'll give me the same error. This is for any code that I write from print("hello, world!") to something more complex.

    When I asked copilot what this meant, it just said that there wasn't supposed to be a "&". I'm not sure what I should do, since it runs perfectly in the command prompt.

    Continue reading...

Compartilhe esta Página