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

python3 AttributeError: 'NoneType' object has no attribute 'split'
 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 '

Hello world

' 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 ['

Hello world

'.encode('utf-8'),]

 

posted on 2016-04-01 21:12 Andy_963 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/Andy963/p/5346439.html

你可能感兴趣的:(python,爬虫,数据库)