Skip to content

Commit 2c316a7

Browse files
committed
set env var to point to right files
1 parent d47262d commit 2c316a7

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/lib/python/pyodide.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,17 @@ export async function asyncRunScenario(
4444
export async function runScenario(scenario: string) {
4545
const pythonProgram = `
4646
import pyodide_http
47+
import pyodide_js
48+
import os
4749
pyodide_http.patch_all()
4850
print(globals())
4951
from js import scenario_json
50-
import demoland_engine
5152
import json
5253
import time
5354
55+
os.environ["DEMOLAND"] = pyodide_js.globals.get("DEMOLAND")
56+
import demoland_engine
57+
5458
start = time.time()
5559
scenario = json.loads(scenario_json)
5660

src/lib/python/pyodide_worker.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ self.onmessage = async (event) => {
4242
// package itself. We need to set this as a global variable here, which lets
4343
// us do `import pyodide_js; pyodide_js.globals.get("BASE_URL")` (in the
4444
// `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);
4647

4748
try {
4849
await self.pyodide.loadPackagesFromImports(python);

0 commit comments

Comments
 (0)