-
Notifications
You must be signed in to change notification settings - Fork 221
Description
Issue
Our program is set up to handle requests sent by a client and then port a message to a python console using python-shell, which then sends back a response with the console output.
Full relevant file can be found here. However, looking at the relevant piece of code:
async spawnTerminal(){
Chatbot.responseList = []
Chatbot.responseOpius = new PythonShell(__dirname + '/../../src/chatbotAPI/chatbot.py', { mode: 'text'})
Chatbot.responseOpius.on('message', function (response : any) {
if (Chatbot.responseList.length != 0){
let sendTo = Chatbot.responseList.shift()
sendTo.res.status(200).send(JSON.stringify(response.replace('>', '')))
}
})
}
Now, this method is called once on startup. When running this setup on win 10, we receive the intended behavior, that is, another python terminal popups and the client is able to send requests and receive a response after the terminal listener is triggered. However, moving the exact same setup onto our servers, running Ubuntu 8 (CLI), the same code throws the following error:
Possible Cause
Again as stated, the EXACT same setup running off Win 10 works but not on Ubunutu 8. Looking at the error message, it seems as if the listener to trying to read from a terminal that doesn't exist. This could be due to the fact that maybe our server is closing all terminal popups. However, from my knowledge, python-shell restarts the terminal if it is closed resulting in a error being spammed into our logs which is not the case. Also, only difference other than that I can see would be missing dependencies, and hence, this issue.