Reputation: 920
I have a small project that uses python3 for the backend and for the front electron.
And in development mode, the electron with the python backend works fine.
But when I make a binary of the backend (with pyinstaller, the onedir option and in GNU/Linux) it works fine when executed directly and through a debian docker container (clean).
But when executed inside a packaged electron (I have tried with zip, AppImage) it doesn't work, I have seen that there is the binary generated by pyinstaller and everything needed in the app.asar file.
This is my test package.json:
{
"name": "electron_version",
"version": "1.0.0",
"description": "",
"main": "index.js",
"build": {
"appId": "com.electron.python",
"files": [
"backend/dist/**" ,
"index.js" , "preload.js" , "index.html"],
"win": {
"target": "nsis"
},
"nsis": {
"oneClick": false,
"perMachine": true,
"allowToChangeInstallationDirectory": true,
"createDesktopShortcut": true,
"createStartMenuShortcut": true
}
},
"scripts": {
"start": "electron .",
"build": "electron-builder "
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"electron": "^33.2.1",
"electron-builder": "^25.1.8"
},
"dependencies": {
"kill-sync": "^1.0.3"
}
}
And this is the bug that comes up when running the appImage generated by electron-builder:
$ ./electron_version-1.0.0.AppImage
[LOG] Resources dir app: /tmp/.mount_electrkTgpul/resources/app
[LOG] Binary to execute: /tmp/.mount_electrkTgpul/resources/app.asar/backend/dist/main/main
[PYI-1293917:ERROR] Failed to load Python shared library '/tmp/_internal/libpython3.10.so.1.0': dlopen: /tmp/_internal/libpython3.10.so.1.0: cannot open shared object file: No such file or directory
Error: Command failed: /tmp/.org.chromium.Chromium.gl3Y2C
[PYI-1293917:ERROR] Failed to load Python shared library '/tmp/_internal/libpython3.10.so.1.0': dlopen: /tmp/_internal/libpython3.10.so.1.0: cannot open shared object file: No such file or directory
at genericNodeError (node:internal/errors:984:15)
at wrappedFn (node:internal/errors:538:14)
at ChildProcess.exithandler (node:child_process:422:12)
at ChildProcess.emit (node:events:518:28)
at maybeClose (node:internal/child_process:1104:16)
at Socket.<anonymous> (node:internal/child_process:456:11)
at Socket.emit (node:events:518:28)
at Pipe.<anonymous> (node:net:343:12) {
code: 255,
killed: false,
signal: null,
cmd: '/tmp/.org.chromium.Chromium.gl3Y2C'
}
The error says that it does not find the dynamic library libpython3.10.so.1.0
but it is inside the _internal
directory in the app.asar
file.
Upvotes: 0
Views: 17