Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/420.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript aws lambda中的节点execFile python脚本_Javascript_Python_Node.js_Aws Lambda_Child Process - Fatal编程技术网

Javascript aws lambda中的节点execFile python脚本

Javascript aws lambda中的节点execFile python脚本,javascript,python,node.js,aws-lambda,child-process,Javascript,Python,Node.js,Aws Lambda,Child Process,我试图通过AWS lambda上托管的节点服务执行脚本,但始终会得到一个enoint异常 2020-04-22 07:55:14.613 (-04:00) 9c8c54fc-2aa2-4d17-89d9-ca1e404191b7 ERROR Error: spawn ./bin/test-bin.py ENOENT at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19) a

我试图通过AWS lambda上托管的节点服务执行脚本,但始终会得到一个enoint异常

2020-04-22 07:55:14.613 (-04:00)    9c8c54fc-2aa2-4d17-89d9-ca1e404191b7    ERROR   Error: spawn ./bin/test-bin.py ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
    at onErrorNT (internal/child_process.js:469:16)
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  errno: 'ENOENT',
  code: 'ENOENT',
  syscall: 'spawn ./bin/test-bin.py',
  path: './bin/test-bin.py',
  spawnargs: [ 1, 2 ],
  cmd: './bin/test-bin.py 1 2'
}
在子进程中执行cat-bin/test-bin.py会吐出脚本的源代码,ls-l通过子进程显示脚本是可执行的,相同的代码在我的linux机器上本地工作

  const { execFile } = require('child_process');
  execFile('cat', ["bin/test-bin.py"], (err, out) => {
    if (err) {
        console.error(err)
    }
    else {
      console.log(out)
    }
  });
剧本:

#!/usr/bin/python

import sys
import time

def sum(n1, n2):
  return int(n1) + int(n2)

print(sum(sys.argv[1], sys.argv[2]))