Seeking for a approach to prevent repeated folder mounting in pyodide webworker.js #4663
-
Issue Description:Hi, all. I am new to using Pyodide and JavaScript. I have three buttons in my HTML script, each triggering a different Python script to process the same input file. I'm using a single webworker.js to handle these scripts and here is the script. in consumer.js
in webworker.js
However, I'm encountering an issue where I have to mount the same directory within the webworker.js each time it's launched (three times for three buttons), and I must change the folder name to avoid an FS (file system) error. I attempted to address this by using pyodide.mountNativeFS('/data', dirHandle) in consumer.js and transferring nativefs as part of the context. Unfortunately, this resulted in a "async()=>new Promise((n,a)=>Module.FS.syncfs(!1,n)) could not be cloned." error. Objective:I'm seeking a better solution to avoid mounting the same folder in each web worker instance. Any insights or guidance on how to achieve this more efficiently would be greatly appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I think you can mount the filesystem once on initialization, and keep reusing them after that, is there some reason for mounting it every time? |
Beta Was this translation helpful? Give feedback.
I think you can mount the filesystem once on initialization, and keep reusing them after that, is there some reason for mounting it every time?