python - 无法在 Alexa 应用程序中调用 child_process
问题描述
我有一个基于 Alexa 的 lambda 函数,我试图在调用 python 函数时生成一个图形。然后 python 模块将生成的图上传到 s3。两者都可以自己正常工作,但是,在 lambda 中运行时,尝试使用子进程调用它们的 python 模块时会抛出错误。进程没有返回任何内容,节点应用程序中没有任何内容使用 python 模块中的任何内容。不知道我在这里做错了什么......
const PlotDataIntentHandler = {
canHandle(handlerInput) {
return handlerInput.requestEnvelope.request.type === 'IntentRequest'
&& handlerInput.requestEnvelope.request.intent.name === 'PlotDataIntent';
},
handle(handlerInput) {
let speechText = ``;
const spawn = require("child_process").spawn;
//simple.py is just a hello world module, but even that won't run
const pythonProcess = spawn('python',["./pythonModules/simple.py"]);
speechText = "Successfully ran python module";
return handlerInput.responseBuilder
.speak(speechText)
.getResponse();
}
};
解决方案
推荐阅读
- javascript - 如何使用 Vue js 创建收藏夹列表。允许用户选择最多 5 个选项
- operating-system - 如何在根级别的 FreeBSD 内核中生成随机数?
- javascript - reactjs中如何根据hash对组件的顺序进行排序/隐藏?
- flutter - Flutter中垂直滚动视图内的水平ListView
- typescript - 打字稿,猫鼬 toObject 返回任何
- ruby-on-rails - 使用原始文件扩展名将 ActiveStorage 上传到 S3
- r - 安装 tidyverse 包时出现问题“loadspacename 中的错误”
- java - 列表视图中的 Nachos 芯片库
- spring - spring jwt解码器openid令牌
- flutter - Algolia 地理搜索未返回结果