You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Question:
I have a nuxt-electron application that I want to use python as my backend. I have a python script that is supposed to run forever and continuously read data from javascript using python-shell. How can I configure python-shell to run my python script without ending the process.
My javascript code in electron's main.js
let python = new PythonShell('./python/client.py',{mode: 'text'});
ipcMain.on('send-msg',(event,data) => {
let win = BrowserWindow.fromWebContents(event.sender);
python.send(data)
python.on('message',(msg) => {
win.send('recv-msg',msg)
});
python.end(err => {
if (err) console.log(err)
});
})
Just a guess as I haven't actually used this library yet, but it looks like you should try moving your python.end(... call to a different ipcMain listener, something like below, while leaving the rest of your code in the ipcMain.on('send-msg'... as it is.
The Question:
I have a nuxt-electron application that I want to use python as my backend. I have a python script that is supposed to run forever and continuously read data from javascript using python-shell. How can I configure python-shell to run my python script without ending the process.
My javascript code in electron's main.js
In my python application
The text was updated successfully, but these errors were encountered: