I'm coding my first app using ElectronJs as a GUI for an older project written in python. When i run my Electron app from the cmd i can successfully activate a python venv using the provided script, run the code written in python and deactivate the venv once the script has exported is results as a file in the out/ folder. All of these actions are handled using the
child_process.spawn()
method and launching a powershell instance with my command as parameter (I don't know if there is a bettere way but this works for me!).
When i try to package a portable executable of my Electron app with electron-builder i know that my python manager script written in js runs but my python code doesn't seem to run and i think that somehow my relative paths no longer work.
I use the following path for my python script:
const pythonScriptPath = path.join(__dirname, '../python/main.py');
Project structure:
root:
+ // other files
+ src:
|
+ js: //folder with all my js files
|
+ html: // folder for html
+ css: // fodlder for css
|
+ py: // all my python stuff in here
+ venv: // folder for my python env
+ // all my python scripts
I need a way to correctly locate my files so my application can run correctly when exported to a portable executable
Edit
I could use pyInstaller to convert my python code to an executable so i don't really have to deal with all the venv stuff but i don't think this will make my life any easier since i'm not able to execute files (or programs with file paths as argument)
"asar": false
in the Electron Builder configuration. See Electron's documentation about ASAR caveats, too.