Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

197
Visualizações
Pyshell.end doesn't get executed. System is stuck on pyshell.on

Pyshell.end is not executing. I am working on this code but pyshell.end doesn't get executed, although I've used next(). It looks like system is stuck on pyshell.on and doesn't move on pyshell.end.

app.post('/app/blogTitle', (req, res, next)=>{
const keywords = req.body.keywords;
const description = req.body.description;
var pyshell = new PythonShell('./Python Files/Titles/run.py');
pyshell.send(JSON.stringify(description));

pyshell.on('message', async function (message) {
  // received a message sent from the Python script 
  arr= await message;
  if (arr.length!==0){
    console.log("Result successfully obtained");
    res.status(200).json(arr);
  }
  else{
    console.log("Some error occurred");
    res.status(500).json({
    msg: 'Server error'
    })
  }
  next();
});

// end the input stream and allow the process to exit
pyshell.end( function (err) {
  if (err){
      throw err;
  };
  console.log('finished');
})
})
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda