码迷,mamicode.com
首页 > 编程语言 > 详细

python3 AttributeError: 'NoneType' object has no attribute 'split'

时间:2016-04-01 22:06:27      阅读:1019      评论:0      收藏:0      [点我收藏+]

标签:

技术分享
 1 from wsgiref.simple_server import make_server
 2  
 3 def RunServer(environ, start_response):
 4     start_response(‘200 ok‘,[(‘Content-Type‘,‘text/html‘)])
 5     return ‘<h1>Hello world</h1>‘
 6 
 7 if __name__ == ‘__main__‘:
 8     httpd = make_server(‘127.0.0.1‘,9000,RunServer)
 9     print(‘servering HTTP on port 9000‘)
10     httpd.serve_forever()
Code

运行时报错:

self.status.split(‘ ‘,1)[0], self.bytes_sent
AttributeError: ‘NoneType‘ object has no attribute ‘split‘

 

解决办法如下:

return [‘<h1>Hello world</h1>‘.encode(‘utf-8‘),]

 

python3 AttributeError: 'NoneType' object has no attribute 'split'

标签:

原文地址:http://www.cnblogs.com/Andy963/p/5346439.html

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!