fix: input prompt message

This commit is contained in:
Timothy J. Baek 2024-05-16 21:09:53 -10:00
parent c7e1d3dbc7
commit c7221983a5

View File

@ -170,7 +170,7 @@
const res = await pyodide.loadPackage('micropip'); const res = await pyodide.loadPackage('micropip');
console.log(res); console.log(res);
pyodide.setStdin({ stdin: () => prompt() }); // pyodide.setStdin({ stdin: () => prompt() });
const micropip = pyodide.pyimport('micropip'); const micropip = pyodide.pyimport('micropip');
@ -186,6 +186,11 @@
console.log(packages); console.log(packages);
await micropip.install(packages); await micropip.install(packages);
result = pyodide.runPython(`from js import prompt
def input(p):
return prompt(p)
__builtins__.input = input`);
result = pyodide.runPython(code); result = pyodide.runPython(code);
if (!result) { if (!result) {