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 pyscript import Element
|
||||
# from pyscript import Element
|
||||
from js import console
|
||||
|
||||
tasks = []
|
||||
|
||||
@@ -96,9 +96,9 @@ class Element:
|
||||
pyscript = PyScript()
|
||||
`
|
||||
|
||||
let loadInterpreter = async function(): any {
|
||||
/* @ts-ignore */
|
||||
let loadInterpreter = async function(): Promise<any> {
|
||||
console.log("creating pyodide runtime");
|
||||
/* @ts-ignore */
|
||||
pyodide = await loadPyodide({
|
||||
stdout: console.log,
|
||||
stderr: console.log
|
||||
@@ -108,15 +108,15 @@ let loadInterpreter = async function(): any {
|
||||
console.log("loading micropip");
|
||||
await pyodide.loadPackage("micropip");
|
||||
console.log('loading pyscript module');
|
||||
await pyodide.runPythonAsync(`
|
||||
from pyodide.http import pyfetch
|
||||
response = await pyfetch("/build/pyscript.py")
|
||||
with open("pyscript.py", "wb") as f:
|
||||
content = await response.bytes()
|
||||
print(content)
|
||||
f.write(content)
|
||||
`)
|
||||
let pkg = pyodide.pyimport("pyscript");
|
||||
// await pyodide.runPythonAsync(`
|
||||
// from pyodide.http import pyfetch
|
||||
// response = await pyfetch("/build/pyscript.py")
|
||||
// with open("pyscript.py", "wb") as f:
|
||||
// content = await response.bytes()
|
||||
// print(content)
|
||||
// f.write(content)
|
||||
// `)
|
||||
// let pkg = pyodide.pyimport("pyscript");
|
||||
|
||||
console.log("creating additional definitions");
|
||||
let output = pyodide.runPython(additional_definitions);
|
||||
@@ -125,7 +125,7 @@ let loadInterpreter = async function(): any {
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user