self.status.split(' ',1)[0], self.bytes_sent 'NoneType' object has no attribute 'split'
来源:互联网 发布:开淘宝店挣钱吗 编辑:程序博客网 时间:2024/06/06 19:51
当我们编写wsgi时候报错
错误内容
self.status.split(' ',1)[0], self.bytes_sentAttributeError: 'NoneType' object has no attribute 'split'
出错代码
def application(environ,start_response): status = '200 OK' response_headers = [('Content-type', 'text/plain')] start_response(status, response_headers) return [u"hello"]from wsgiref.simple_server import make_server#导入系统的wsgi包from webapp import application#引入服务器的代码server =make_server('', 8080, application)#实例化一个监听8080端口的服务器server.serve_forever()#开始监听http请求
解决方案
给返回内容加上.encode(‘utf8’)
return [u"hello".encode('utf8')]
阅读全文
0 0
- self.status.split(' ',1)[0], self.bytes_sent 'NoneType' object has no attribute 'split'
- AttributeError: ‘NoneType’ object has no attribute ‘clone’
- AttributeError: 'NoneType' object has no attribute 'clone'
- python : 'NoneType' object has no attribute 'recv'
- AttributeError: 'NoneType' object has no attribute
- AttributeError: 'NoneType' object has no attribute 'startswith'
- Python: Attribute Error - 'NoneType' object has no attribute 'something'
- python __def__ Exception AttributeError: "'NoneType' object has no attribute
- python __def__ Exception AttributeError: "'NoneType' object has no attribute
- [Python][转]Exception AttributeError: "'NoneType' object has no attribute
- Exception AttributeError: "'NoneType' object has no attribute
- python PIL bug: 'NoneType' object has no attribute 'bands' (解决)
- scapy AttributeError: 'NoneType' object has no attribute 'route'解决办法
- python使用PIL库报错,'NoneType' object has no attribute 'bands'
- selenium 2.0 'NoneType' object has no attribute 'send_keys'
- AttributeError: 'NoneType' object has no attribute 'sc' 解决方法!
- AttributeError: 'NoneType' object has no attribute 'sc' 解决方法(二)
- Scraper_compare( 'NoneType' object has no attribute 'group')
- Oracle commit和checkpoint区别
- 从授时服务器上获得时间
- 【Vue】1.基于vue-cli的快速构建
- 第七周 自建算法库——链队
- Unreal Excel表格导入和使用(中文乱码问题)
- self.status.split(' ',1)[0], self.bytes_sent 'NoneType' object has no attribute 'split'
- 第九周项目2
- 颠覆千年传统,荣获“中国好设计”金奖,行走的茶具陪你过寒冬丨钛空舱双十一特惠
- 第十一周 【项目1
- 第十周-项目1
- 最流行的Spring Cloud微服务架构实践与经验总结
- Bayes and MC
- Git 与SVN
- 第十一周 【项目1