我试图通过PythonShell在nodejs中运行python脚本。但我的结果是空的。我不知道python脚本是返回空值还是nodejs代码中有问题。你知道吗
节点代码
var PythonShell = require('python-shell');
////options for python-shell
PyShellOptions={
mode: 'JSON',
pythonOptions: ['-u'],
scriptPath: 'F:/University/Final Year/FYP/From Shafeeq/ECG-Diagnosis (Python)',//python scripts folder
args: [signal_file,sample_rate,user.meta.age,user.meta.gender,user.meta.height,user.meta.weight]
};
PythonShell.run('main.py', PyShellOptions, function (err, results) {
console.log(err);
if (err) {
console.log(err.message)
}
// results is an array consisting of messages collected during execution
console.log('results: %j', results);
}
Python代码
print(json_content)
目前没有回答
相关问题 更多 >
编程相关推荐