How to load a script from an asar file?
Is there a way to load the script that is stored inside an asar file? I am working with electron and I need to package everything into asar file (more efficiency, signed app, etc):
var py_options = {
mode: 'text',
pythonPath: self.python_path,
scriptPath: loc // how to write the location in the asar file here?
};
python_shell.run('get_python_version.py', py_options, function (err, results) {
if (err) {
console.log('>> Error running script: ' + err);
} else {
console.log(results[0]);
}
});
But the file is not found if it is packaged in the asasr file. Is there a chance to make this work? Maybe using fs library somewhere? More about asar
Take a look at my arepl electron repo, it might help you out
@Almenon I see a python-shell dependency in your repository, but I do not see where you are using it. Could you show me please? Thanks. Should I use another different tool?

Oh wait, I didn't use the script path option in my repo. I'm not sure what path you need, sorry.
@chesucr Did you find a solution for this?
@sujiths no, I just stored the script outside the asar file. With electron-builder you can use asar = False, or asarUnpack which is better
@chesucr Thanks. I also did that finally
has someone else found a working solution with having the python script inside the asar archive?
I have worked around this problem with just copying the python-script synchronously in the runtime to a path outside the asar archive and then run the script, which worked great
On Windows to copying seems to be broken, because it also loads all the files into a temp folder, but does never clean it up. So your harddisk gets full.