I was working on a code using python and node. I called python code using child-process in node js to use its outputs.
var images_score = 0
const python = spawn('python',[__dirname + "/car_detect/main.py", img_name]);
python.stdout.on('data', (data) => {
images_score = Number(data.toString());
console.log(images_score);
})
}
if (images_score == 1){
//some code here
}else{
console.log('err');
}
but before I receive the result (data.toString() == '1'), node continues the program without giving the output of my python code and shows me 'err' in the console.