Commit 2c316a7 1 parent d47262d commit 2c316a7 Copy full SHA for 2c316a7
File tree 2 files changed +7
-2
lines changed
2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -44,13 +44,17 @@ export async function asyncRunScenario(
44
44
export async function runScenario ( scenario : string ) {
45
45
const pythonProgram = `
46
46
import pyodide_http
47
+ import pyodide_js
48
+ import os
47
49
pyodide_http.patch_all()
48
50
print(globals())
49
51
from js import scenario_json
50
- import demoland_engine
51
52
import json
52
53
import time
53
54
55
+ os.environ["DEMOLAND"] = pyodide_js.globals.get("DEMOLAND")
56
+ import demoland_engine
57
+
54
58
start = time.time()
55
59
scenario = json.loads(scenario_json)
56
60
Original file line number Diff line number Diff line change @@ -42,7 +42,8 @@ self.onmessage = async (event) => {
42
42
// package itself. We need to set this as a global variable here, which lets
43
43
// us do `import pyodide_js; pyodide_js.globals.get("BASE_URL")` (in the
44
44
// `cache.py` file).
45
- // self.pyodide.globals.set("BASE_URL", BASE_URL);
45
+ let secondLastPart = window . location . pathname . split ( "/" ) . slice ( - 2 , - 1 ) [ 0 ] ;
46
+ self . pyodide . globals . set ( "DEMOLAND" , secondLastPart ) ;
46
47
47
48
try {
48
49
await self . pyodide . loadPackagesFromImports ( python ) ;
You can’t perform that action at this time.
0 commit comments