I’m working with the pyodide library and i’ve ran into an issue, I need to add a handler for stdin, however I’m running pyodide in a web worker and I don’t have access to the window
or any sort of prompt
.
pyodide.setStdin({ stdin: () => {
// code here
}})
I have tried using the postMessage()
function to ask the page for input and send it back, but since I am returning this from a function I am unable to receive the input before I have to return. I have also tried using SharedArrayBuffer
and Atomics
to freeze the web worker until the page responds, but I was unable to figure out a solution with those, however I think it’s a good starting point. Most solutions I’ve seen so far have just been to restructure code, but since pyodide is an external library I am forced to return from the function I set in pyodide.setStdin