Electron with python won't run when packaged

36 views Asked by At

I am packaging an Electron desktop app that runs a Flask server locally. Whenever I try to run the standalone app that is created from the project I get the error below. When I run the project using npm run I don't get this error and the backend works perfectly. This error is extremely recent and python with the backend has worked perfectly up until this point. Any help would be appreciated!

Uncaught Exception:
Error: spawn python3.11 ENOENT
at ChildProcess._handle.onexit (node:internal/child_process:286:19)
at onErrorNT (node:internal/child_process:484:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

JS code

app.whenReady().then(() => {
  const expressProcess = spawn('python3.11', [path.join(__dirname, 'server', 'test.py')]);

  expressProcess.stdout.on('data', (data) => {
    console.log(`Flask Output: ${data}`);
  });

  expressProcess.stderr.on('data', (data) => {
    console.error(`Flask Error: ${data}`);
  });

  app.dock && app.dock.setIcon(path.join(__dirname, 'images', 'Logo.png'));

  createWindow();
});
0

There are 0 answers