Skip to content

Commit

Permalink
set env var to point to right files
Browse files Browse the repository at this point in the history
  • Loading branch information
martinfleis committed Feb 19, 2024
1 parent d47262d commit 2c316a7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/lib/python/pyodide.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,17 @@ export async function asyncRunScenario(
export async function runScenario(scenario: string) {
const pythonProgram = `
import pyodide_http
import pyodide_js
import os
pyodide_http.patch_all()
print(globals())
from js import scenario_json
import demoland_engine
import json
import time
os.environ["DEMOLAND"] = pyodide_js.globals.get("DEMOLAND")
import demoland_engine
start = time.time()
scenario = json.loads(scenario_json)
Expand Down
3 changes: 2 additions & 1 deletion src/lib/python/pyodide_worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ self.onmessage = async (event) => {
// package itself. We need to set this as a global variable here, which lets
// us do `import pyodide_js; pyodide_js.globals.get("BASE_URL")` (in the
// `cache.py` file).
// self.pyodide.globals.set("BASE_URL", BASE_URL);
let secondLastPart = window.location.pathname.split("/").slice(-2, -1)[0];
self.pyodide.globals.set("DEMOLAND", secondLastPart);

try {
await self.pyodide.loadPackagesFromImports(python);
Expand Down

0 comments on commit 2c316a7

Please sign in to comment.