pyodide

Executing Python via newer versions of Pyodide in React leads to an error

Executing Python via newer versions of Pyodide in React leads to an error Question: I am a React and Pyodide newbie. I am trying to get the following code to work in a way that I can utilize some OpenCV functionality. The code below works and I can use numpy, etc in the calculations. However, …

Total answers: 1

How to render a python panel component from react with pyodide?

How to render a python panel component from react with pyodide? Question: I am trying to use an example from the panel documentation of how to display a panel component from python using pyodide, but from a react component, instead of from pure html. I have set up a minimal NextJS react app which can …

Total answers: 2

how to get active REPL block in PyScript and copy whatever code written in it?

how to get active REPL block in PyScript and copy whatever code written in it? Question: I have multiple code blocks in pyscript repl which were created dynamically on button click. I want to know which code block is active. I know library adds cm-activeLine class when line is active but that changes when I …

Total answers: 1

Unable to import a python package in Pyodide

Unable to import a python package in Pyodide Question: I am trying to import a custom package in Pyodide but it is not working. The directory structure is index.html package/ __init__.py And my index.html looks like this <!DOCTYPE html> <html> <head> <script src="https://cdn.jsdelivr.net/pyodide/v0.19.1/full/pyodide.js"></script> </head> <body> Pyodide test page <br /> Open your browser console to …

Total answers: 2

PyScript: Get image from API and display on webpage

PyScript: Get image from API and display on webpage Question: this is my first question on SO. Please give me directions if the question is not clear. I am trying to get an image from a public API and write it on a webpage using PyScript. However, I am not able to get the image …

Total answers: 2

Pyodide runPythonAsync to html document

Pyodide runPythonAsync to html document Question: I am trying to run a simple pyodide example, but am not too familiar with javascript or pyodide and am not sure why the output is undefined. The statement is executed fine as I can see the correct output in the console log, but I cannot assign the output …

Total answers: 1

How do I import modules in a project using pyodide without errors?

How do I import modules in a project using pyodide without errors? Question: Whenever I import python modules in a pyodide, it gives this error. pyodide.js:108 Invalid package name or URI I am not sure how to properly import modules, I have tried this which was mentioned in the docs. pyodide.loadPackage(‘<module address>’) (this returns a …

Total answers: 1

How to redirect/render Pyodide output in browser?

How to redirect/render Pyodide output in browser? Question: I have recently come across the Pyodide project. I have built a little demo using Pyodide, but although I’ve spent a lot of time looking at the source, it is not obvious (yet) to me how to redirect print output from python (other than modifying the CPython …

Total answers: 5