Skip to content

Commit

Permalink
Add a note about Python loader code. NFC
Browse files Browse the repository at this point in the history
  • Loading branch information
whitequark committed May 18, 2024
1 parent dc68a80 commit fca9b4e
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,7 @@ function workerEntryPoint(self: WorkerContext) {
} else {
pyodide = await preparePyodide(args);
console.log(`[YoWASP Toolchain] Running Python file '${args[0]}'...`);
// This could be read from `pyodide.FS`, but error handling gets really weird.
const pyArgv0 = `__import__("sys").argv[0]`;
const pyReadFile = `(lambda f: (f.read(), f.close()))(open(${pyArgv0}))[0]`;
const pyLoader = `exec(compile(${pyReadFile}, ${pyArgv0}, 'exec'))`;
Expand Down

0 comments on commit fca9b4e

Please sign in to comment.