函数计算的 Python手册小问题
函数计算的 Python手册小问题
今天跟着 函数计算 Python 入门手册 一起做,被卡在下图这里报错。在关于 WSGI 普通入口函数介绍中:
{
"errorMessage": "'NoneType' object has no attribute 'split'",
"errorType": "AttributeError",
"stackTrace": [
[
"File \"/var/fc/runtime/python2.7/src/server.py\"",
"line 276",
"in do_POST",
"wsgi_handler.run(application)"
],
[
"File \"/usr/local/lib/python2.7/wsgiref/handlers.py\"",
"line 92",
"in run",
"self.close()"
],
[
"File \"/usr/local/lib/python2.7/wsgiref/simple_server.py\"",
"line 33",
"in close",
"self.status.split(' ',1)[0], self.bytes_sent"
]
]
}
参考 简单的WSGI例子 - CSDN 加入这句 context('200 OK', [('Content-Type', 'text/html')])
def handler(event, context):
context('200 OK', [('Content-Type', 'text/html')])
return '<h1>Hello, web!</h1>'
即可。