PyScript Syntax Error when page is loaded on github pages

Viewed 22

Below code works well on local host.
but when the page is loaded on the github pages(jekyll blog), it doesn't work with error message which is 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 from js import document def main(): content = document.getElementById('test3').children[0]; content.innerHTML = 'output3' main() ^^^ SyntaxError: invalid syntax ).

What's happening...T_T

+Details Added:

  • Below code is written on the markdown file.
  • Error occurs when deploy on github pages.
  • My operation system is windows 10.
<!-- PyScript -->
<script defer src="https://pyscript.net/latest/pyscript.js"></script>

<div id="test3">
  <p style="font-size: 1.5rem; color: orange;">Loading...</p>
</div>

<py-script>
from js import document

def main():
    content = document.getElementById('test3').children[0];
    content.innerHTML = 'output3'

main()
</py-script>
0 Answers
Related