Pyscript over CDN get exception: JsException(PythonError: Traceback (most recent call last)

Pyscript over CDN get exception: JsException(PythonError: Traceback (most recent call last)

我想尝试 pyscript 并立即 运行 进入此错误。我做了什么?

HTML

<!doctype html>
 <html lang="en">
 <head>
   <meta charset="utf-8">
   <title>Py Script</title>
   <meta name="description" content="HTML">
   <meta name="author" content="lowrey">
   <link rel="stylesheet"
   href="https://pyscript.net/alpha/pyscript.css" />
   
 </head>
 <body>
     <py-script>print("Hello Anaconda").</py-script>
    <script defer
    src="https://pyscript.net/alpha/pyscript.js"></script>   
 </body>
 </html>

Error/exeption

JsException(PythonError: Traceback (most recent call last): File
"/lib/python3.10/site-packages/_pyodide/_base.py", line 421, in eval_code
CodeRunner( File "/lib/python3.10/site-packages/_pyodide/_base.py", line 237, in
__init__ self.ast = next(self._gen) File
"/lib/python3.10/site-packages/_pyodide/_base.py", line 141, in
_parse_and_compile_gen mod = compile(source, filename, mode, flags |
ast.PyCF_ONLY_AST) File "", line 1 print("Hello Anaconda"). ^ SyntaxError:
invalid syntax )

Pyscript 文档:https://anaconda.cloud/pyscript-python-in-the-browser

您有一个 Python 语法错误。这 。 (点)在字符串之外。

更改此行:

<py-script>print("Hello Anaconda").</py-script>

为此:

<py-script>print("Hello Anaconda.")</py-script>