I have been following the instructions on “Running Panel in the Browser with WASM” to convert a simple panel applications (e.g., slider widget) into a Pyodide.
First, I created the test.py file with my script for the slider widget. Then I ran “panel convert script.py --to pyodide-worker --out pyodide”, which was successful. Now I have the new pyodide folder with the .html & .js files.
Next, I ran “python -m http.server”, which I get “Serving HTTP on :: port 8000 (http://[::]:8000/) …”.
Now when I paste this “http://localhost:8000/pyodide/test.html” to my web browser, the app works great. But when I go to the pyodide folder and click on the test.html file, the app gets stuck in the loading phase.
I think the problem is that you cannot open the .html files directly from a file share due to browser security restrictions. That is why the Panel documentation shows how you serve via python -m http.server .... See javascript - Chrome can’t load web worker - Stack Overflow.
Could you try running panel convert script.py --out pyodide instead and see if it works? It may be slower to load without the web workers though.
Thank you @Marc!
I ran the “panel convert script.py --out pyodide” and the .html file opens. I then tried using the web worker, and then moved the files (.html & .js) to Github pages, which also works!
So my problem was probably because of the web worker and browser restrictions.