GreyHope
(Reuben Ford)
1
I have managed to compile Python to WebAssembly according the inscructions in the README. The python.html
REPL works perfectly in the browser.
How can I load (and then import) a custom Python module into the browser? In my case, the module I’d like to import is a C extension.
1 Like
GreyHope
(Reuben Ford)
2
I have found a working solution. I used the Emscripten FS
object to load my file to the virtual filesystem.
FS.mkdir("/Module")
FS.mount(WORKERFS, {blobs: [{name: "__init__.py", data: blob}],}, "/Module")
The Python import
statement works when I attempt to load the module.