OpenWhisk Python 操作因未返回字典错误而失败
OpenWhisk Python action failing with not returning dictionary error
我正在尝试 运行 使用 OpenWhisk 实现此功能:
def main():
return {"payload": "Hello world"}
具有以下内容:
> bx wsk action create hello_python hello_python.py
> bx wsk action invoke hello_python
当 运行在本地返回字典时返回一个字典,但是 运行上面给出了这个错误:
"result": {
"error": "The action did not return a dictionary."
}
我在这里错过了什么?
将您的代码更改为:
def main(args):
return {"payload": "Hello world"}
The Python actions consume and produce a dictionary。因此你需要 "args".
main() input can't be empty takes a dict like main(args)
def main(args):
return {"payload": "Hello world"}
我正在尝试 运行 使用 OpenWhisk 实现此功能:
def main():
return {"payload": "Hello world"}
具有以下内容:
> bx wsk action create hello_python hello_python.py
> bx wsk action invoke hello_python
当 运行在本地返回字典时返回一个字典,但是 运行上面给出了这个错误:
"result": {
"error": "The action did not return a dictionary."
}
我在这里错过了什么?
将您的代码更改为:
def main(args):
return {"payload": "Hello world"}
The Python actions consume and produce a dictionary。因此你需要 "args".
main() input can't be empty takes a dict like main(args)
def main(args):
return {"payload": "Hello world"}