mirror of
https://github.com/pyscript/pyscript.git
synced 2022-05-01 19:47:48 +03:00
remove pyscript being loaded externally for now
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
from datetime import datetime as dt
|
from datetime import datetime as dt
|
||||||
from pyscript import Element
|
# from pyscript import Element
|
||||||
from js import console
|
from js import console
|
||||||
|
|
||||||
tasks = []
|
tasks = []
|
||||||
|
|||||||
@@ -96,9 +96,9 @@ class Element:
|
|||||||
pyscript = PyScript()
|
pyscript = PyScript()
|
||||||
`
|
`
|
||||||
|
|
||||||
let loadInterpreter = async function(): any {
|
let loadInterpreter = async function(): Promise<any> {
|
||||||
/* @ts-ignore */
|
|
||||||
console.log("creating pyodide runtime");
|
console.log("creating pyodide runtime");
|
||||||
|
/* @ts-ignore */
|
||||||
pyodide = await loadPyodide({
|
pyodide = await loadPyodide({
|
||||||
stdout: console.log,
|
stdout: console.log,
|
||||||
stderr: console.log
|
stderr: console.log
|
||||||
@@ -108,15 +108,15 @@ let loadInterpreter = async function(): any {
|
|||||||
console.log("loading micropip");
|
console.log("loading micropip");
|
||||||
await pyodide.loadPackage("micropip");
|
await pyodide.loadPackage("micropip");
|
||||||
console.log('loading pyscript module');
|
console.log('loading pyscript module');
|
||||||
await pyodide.runPythonAsync(`
|
// await pyodide.runPythonAsync(`
|
||||||
from pyodide.http import pyfetch
|
// from pyodide.http import pyfetch
|
||||||
response = await pyfetch("/build/pyscript.py")
|
// response = await pyfetch("/build/pyscript.py")
|
||||||
with open("pyscript.py", "wb") as f:
|
// with open("pyscript.py", "wb") as f:
|
||||||
content = await response.bytes()
|
// content = await response.bytes()
|
||||||
print(content)
|
// print(content)
|
||||||
f.write(content)
|
// f.write(content)
|
||||||
`)
|
// `)
|
||||||
let pkg = pyodide.pyimport("pyscript");
|
// let pkg = pyodide.pyimport("pyscript");
|
||||||
|
|
||||||
console.log("creating additional definitions");
|
console.log("creating additional definitions");
|
||||||
let output = pyodide.runPython(additional_definitions);
|
let output = pyodide.runPython(additional_definitions);
|
||||||
@@ -125,7 +125,7 @@ let loadInterpreter = async function(): any {
|
|||||||
return pyodide;
|
return pyodide;
|
||||||
}
|
}
|
||||||
|
|
||||||
let loadPackage = async function(package_name: string[] | string, runtime: any): any {
|
let loadPackage = async function(package_name: string[] | string, runtime: any): Promise<any> {
|
||||||
await runtime.loadPackage(package_name);
|
await runtime.loadPackage(package_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user