AWS lambda通过python/curl将文件上载到API无法识别tmp文件
有人能解释为什么我的python代码无法将文件上传到api吗 logger.infois videofilethere:{}\n.formatos.path.isfile'/tmp/'+videoFileName+'.mp4' [信息]2017-10-23T05:59:26.274Z 52e8b51d-b7b7-11e7-b687-450a720c44f3是 那是真的 但是 [错误]2017-10-23T05:59:26.278Z 52e8b51d-b7b7-11e7-b687-450a720c44f3[错误号2] 没有这样的文件或目录AWS lambda通过python/curl将文件上载到API无法识别tmp文件,python,amazon-web-services,lambda,Python,Amazon Web Services,Lambda,有人能解释为什么我的python代码无法将文件上传到api吗 logger.infois videofilethere:{}\n.formatos.path.isfile'/tmp/'+videoFileName+'.mp4' [信息]2017-10-23T05:59:26.274Z 52e8b51d-b7b7-11e7-b687-450a720c44f3是 那是真的 但是 [错误]2017-10-23T05:59:26.278Z 52e8b51d-b7b7-11e7-b687-450a720c
这与/tmp/somefile.mp4无关 subprocess.call找不到curl。您应该在调用中使用shell=True。以下是一个简化的示例:
def lambda_handler(event, context):
import subprocess
result = subprocess.call("curl -I http://google.com", shell=True)
return result
def lambda_handler(event, context):
import subprocess
result = subprocess.call("curl -I http://google.com", shell=True)
return result