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.

本文标签: