admin管理员组文章数量:1391995
Should be pretty straight forward, but I keep getting this modulenotfound error. And it looks like every year they change the way to do it and deprecate all other ways.
This is my index.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href=".3.1/core.css" />
<script type="module" src=".3.1/core.js"></script>
</head>
<body>
<button id="button">¡Di Hola!</button>
<div id="saludo"></div>
<!-- Cargamos un módulo propio antes del código python -->
<py-import src="/hazAlgo.py"></py-import>
<!-- Aquí va el código python -->
<py-script>
from js import document
from pyodide.ffi.wrappers import add_event_listener
import hazAlgo
hazAlgo.hola()
btn = document.getElementById("button")
add_event_listener(btn, "click", hola)
</py-script>
</body>
</html>
hazAlgo.py is located in the same folder as index.html
I tried using the <py-import src="/hazAlgo.py"></py-import>
tag that both Gemini and ChatGPT insist should be working, but they can't help me fix it.
本文标签:
版权声明:本文标题:local - Can't get pyscript to import a simple module in the same directory. I see this question all over, but none of th 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744577306a2613704.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论