ich benutze zum ersten mal PyScript und bekomme eine Fehlermeldung, wenn ich meinen Code mit Live Server ausführe.
Der HTML code:
Code: Alles auswählen
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SAMPLE TEXT</title>
<link rel="stylesheet" href="https://pyscript.net/latest/pyscript.css" />
<script defer src="https://pyscript.net/latest/pyscript.js"></script>
</head>
<body>
<py-script><test class="py"></test></py-script>|
</body>
</html>
Python code:
Code: Alles auswählen
import random
chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIFKLMNOPQRSTUVWXYZ123456!@#$%^&*()_+={}[]\|:;/?.,><|`~*-"
while 1:
password_len = int(input("# of Characters: "))
password_count = int(input("Amout: "))
for x in range(0,password_count):
password = ""
for x in range(0,password_len):
password_char = random.choice(chars)
password = password + password_char
print("output : ", password)
Wenn ich die HTML Seite mit LiveServer ausführe, kommt die Fehlermeldung:
Code: Alles auswählen
PythonError: Traceback (most recent call last): File "/lib/python3.10/asyncio/futures.py", line 201, in result raise self._exception File "/lib/python3.10/asyncio/tasks.py", line 232, in __step result = coro.send(None) File "/lib/python3.10/site-packages/_pyodide/_base.py", line 506, in eval_code_async await CodeRunner( File "/lib/python3.10/site-packages/_pyodide/_base.py", line 241, in __init__ self.ast = next(self._gen) File "/lib/python3.10/site-packages/_pyodide/_base.py", line 142, in _parse_and_compile_gen mod = compile(source, filename, mode, flags | ast.PyCF_ONLY_AST) File "", line 1 ^ SyntaxError: invalid syntax
|