Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 1 addition & 13 deletions src/livecodes/languages/python-wasm/lang-python-wasm-script.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable no-underscore-dangle */
import { fontAwesomeUrl, pyodideBaseUrl } from '../../vendors';
import { pyodideBaseUrl } from '../../vendors';

declare const loadPyodide: any;

Expand Down Expand Up @@ -50,21 +50,13 @@ window.addEventListener('load', async () => {
}

async function prepareEnv() {
// needed for matplotlib icons
const stylesheet = document.createElement('link');
stylesheet.rel = 'stylesheet';
stylesheet.href = fontAwesomeUrl;
document.head.append(stylesheet);

await pyodideReady;
const patchInput = `
from js import prompt
def input(p):
return prompt(p)
__builtins__.input = input
`.trim();
// in Pyodide v0.26.x runPythonAsync does not resolve in the following times
// use runPython instead
await livecodes.pyodide.runPythonAsync(patchInput);
}

Expand All @@ -82,8 +74,6 @@ __builtins__.input = input
try {
await livecodes.micropip.install(pkg);
} catch (err) {
// in Pyodide v0.26.x this needs to be done,
// otherwise the following micropip installs do not resolve
// livecodes.excludedPackages.push(pkg);
}
}
Expand All @@ -96,8 +86,6 @@ __builtins__.input = input
await loadPackagesInCode(code);
try {
livecodes.pyodideState = livecodes.pyodide.pyodide_py._state.save_state();
// in Pyodide v0.26.x runPythonAsync does not resolve in the following times
// use runPython instead
await livecodes.pyodide.runPythonAsync(code);
} catch (err) {
// eslint-disable-next-line no-console
Expand Down