not preloading model when started from node with child process
lxknvlk opened this issue · comments
Alex commented
The script stops at this line
# Pre-load caffe model.
nsfw_net = caffe.Net(model_def, pretrained_model, caffe.TEST)
Everything else in python works fine. And the script run directly works fine too. Why it is not working when called from child-process?
When i run it from a node app like this
const cp = require("child_process")
const spawn = cp.spawn;
const pythonProcess = spawn('python',['/home/ubuntu/classify.py']);
pythonProcess.stdin.write(req.body.image, function(err){
pythonProcess.stdin.end();
});
pythonProcess.stdout.on('data', (data) => {
console.log("message from python:" + data)
});
pythonProcess.stdout.on("end", (data) => {
console.log("end received data: " + data);
res.status(200);
res.end();
});
Alex commented
I have added pythonProcess.stderr.pipe(process.stderr);
to my nodejs app and then i was able to see errors from python script, and fix it.