From c7221983a51cfffc4c407b01a787b69794c1102d Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Thu, 16 May 2024 21:09:53 -1000 Subject: [PATCH] fix: input prompt message --- src/lib/components/chat/Messages/CodeBlock.svelte | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/lib/components/chat/Messages/CodeBlock.svelte b/src/lib/components/chat/Messages/CodeBlock.svelte index 2b02c5dd8..c470a4354 100644 --- a/src/lib/components/chat/Messages/CodeBlock.svelte +++ b/src/lib/components/chat/Messages/CodeBlock.svelte @@ -170,7 +170,7 @@ const res = await pyodide.loadPackage('micropip'); console.log(res); - pyodide.setStdin({ stdin: () => prompt() }); + // pyodide.setStdin({ stdin: () => prompt() }); const micropip = pyodide.pyimport('micropip'); @@ -186,6 +186,11 @@ console.log(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); if (!result) {