在AWS Lambda上使用Python中的NodeJS 4脚本 [英] Using a NodeJS 4 script from Python on AWS Lambda

查看:68
本文介绍了在AWS Lambda上使用Python中的NodeJS 4脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  • 我有一个在AWS Lambda上运行的Python脚本.
  • 此脚本使用subprocess执行NodeJS 4脚本.
  • I have a Python script running on AWS Lambda.
  • This script is using subprocess to execute a NodeJS 4 script.
  • subprocess.check_output('my-script.js');
  • 得到了非零结果
  • 得到解释器错误:

  • subprocess.check_output('my-script.js');
  • Got a non-zero result
  • Got the interpreter error:

node.js的版本不满足最低要求. 请确保系统具有node.js 4.0.0或更高版本.

Version of node.js doesn't meet minimum requirement. Please ensure system has node.js version 4.0.0 or higher.

是否可以使用Python AWS Lambda中的NodeJS 4脚本?

Is it possible to use a NodeJS 4 script from a Python AWS Lambda?

推荐答案

您不能依赖Lambda python运行时中存在的node. AWS可能会随时删除或更改它.

You cannot rely on node existing on the Lambda python runtimes. AWS might remove or change it any time.

最好将它们翻译成一种语言,这样就只需要一种运行时.将节点脚本翻译成python或将python脚本翻译成node.

It would be best if you just translate them into one language so you only need one runtime. Either translate the node script into python or translate the python script to node.

如果翻译不可行,则可以创建两个Lambda函数-一个在Python中,一个在Node中.然后,您可以让Python Lambda使用

If translation is not feasible, you can create two Lambda functions -- one in Python and one in Node. You can then have the Python Lambda invoke the Node Lambda using .invoke()

这篇关于在AWS Lambda上使用Python中的NodeJS 4脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆