`SyntaxError: Ungültiges SyntaxPython

Python-Programme
Guest
 `SyntaxError: Ungültiges Syntax

Post by Guest »

Ich versuche, ein Python -Skript aus dem Visual Studio -Code auszuführen, aber das Skript kann nicht ausgeführt werden und stürzt mit einem SyntaxError nicht aus, der auf den Kommentar zu Beginn von Start.json .

Code: Select all

launch.json
:

Code: Select all

{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python | Default",
"type": "python",
"request": "launch",
"stopOnEntry": false,
"pythonPath": "${config:python.pythonPath}",
"program": "${file}",
"cwd": "${workspaceFolder}",
"env": {},
"envFile": "${workspaceFolder}/.env",
"debugOptions": [
"RedirectOutput"
]
}
]
}
< /code>

Terminalausgabe: < /p>
File ".../.vscode/launch.json", line 2
// Use IntelliSense to learn about possible attributes.
^
SyntaxError: invalid syntax
< /code>

settings.json
:

Code: Select all

{
"python.pythonPath": "${workspaceFolder}/venv/bin/python"
}
< /code>

I was working on my Windows machine earlier and all of this worked perfectly fine. For some reason, VSCode is trying to run the launch.json
Datei über Python und // ist eine ungültige Kommentarsyntax in Python. Wenn ich die Kommentare entferne, erhalte ich diesen Fehler: < /p>

Code: Select all

Traceback (most recent call last):
File ".../.vscode/launch.json", line 8, in 
"stopOnEntry": false,
NameError: name 'false' is not defined
Wenn ich Pythons false verwende, stürze ich nicht, aber nichts passiert und mein Skript wird nicht ausgeführt. Es scheint sehr ähnlich zu sein, dass Start.json von Python fälschlicherweise analysiert wird. Irgendeine Fix dafür?

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post