I use tag in html to use methodes from a .py file in .html page , so I start with this in html body:
<py-env>
- paths:
- ./methodes.py
</py-env>
then i use the methode getEmoji(string) :
<py-script>
from methodes import *
text = "ubio gfsh"
print(justFr(text))
</py-script>
my page .html and the file methodes.py in same folder , and i get this message :
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 2 text = "ubio gfsh" ^ IndentationError: unexpected indent )
any help Please ...
You must use Python indenting otherwise the Python interpreter will report the error IndentationError: unexpected indent.
Delete the spaces in front of each Python code line:
Only indent lines when Python requires it.