Cannot run a python file using child_process.spawn inside asar archive in electron app

var pyfilebuffer = fs.realpathSync('./resources/app.asar/PyBuild/');
function start()
 subpy = child_process.spawn('python', [pyfilebuffer], {detached: true});

I’ve also tried hardcoding the fullpath of the python file located inside the asar file, but still I face the same problem. So please help me solve this issue.


I could be wrong on this but I’m gonna say at first guess… no. I think I attempted to do something similar before. If I remember correctly… if you are trying to read into that path from within electron, you can because it can read into the asar package but with an fs.spawn, your actually attempting to read into the asar package from “outside” of electron and therefore it can’t actually use that path.

I was wanting to do similar with kicking off additional node processes to abstract functionality away from the main process and use scripts that I already had working as a new process.


Thanks for your reply. I’m now keeping the python file outside and calling it.