python make_server 报错解码问题
File "C:\Users\w\AppData\Local\Programs\Python\Python37\lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "C:\Users\w\AppData\Local\Programs\Python\Python37\lib\wsgiref\handlers.py", line 182, in finish_response
self.write(data)
File "C:\Users\w\AppData\Local\Programs\Python\Python37\lib\wsgiref\handlers.py", line 268, in write
"write() argument must be a bytes instance"
AssertionError: write() argument must be a bytes instance
127.0.0.1 - - [03/Dec/2018 16:31:31] "GET /index HTTP/1.1" 500 59
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 59042)
Traceback (most recent call last):
File "C:\Users\w\AppData\Local\Programs\Python\Python37\lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "C:\Users\w\AppData\Local\Programs\Python\Python37\lib\wsgiref\handlers.py", line 182, in finish_response
self.write(data)
File "C:\Users\w\AppData\Local\Programs\Python\Python37\lib\wsgiref\handlers.py", line 268, in write
"write() argument must be a bytes instance"
AssertionError: write() argument must be a bytes instance
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\w\AppData\Local\Programs\Python\Python37\lib\wsgiref\handlers.py", line 141, in run
self.handle_error()
File "C:\Users\w\AppData\Local\Programs\Python\Python37\lib\wsgiref\handlers.py", line 370, in handle_error
self.finish_response()
File "C:\Users\w\AppData\Local\Programs\Python\Python37\lib\wsgiref\handlers.py", line 182, in finish_response
self.write(data)
File "C:\Users\w\AppData\Local\Programs\Python\Python37\lib\wsgiref\handlers.py", line 276, in write
self.send_headers()
File "C:\Users\w\AppData\Local\Programs\Python\Python37\lib\wsgiref\handlers.py", line 333, in send_headers
if not self.origin_server or self.client_is_modern():
File "C:\Users\w\AppData\Local\Programs\Python\Python37\lib\wsgiref\handlers.py", line 346, in client_is_modern
return self.environ['SERVER_PROTOCOL'].upper() != 'HTTP/0.9'
TypeError: 'NoneType' object is not subscriptable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\w\AppData\Local\Programs\Python\Python37\lib\socketserver.py", line 313, in _handle_request_noblock
self.process_request(request, client_address)
File "C:\Users\w\AppData\Local\Programs\Python\Python37\lib\socketserver.py", line 344, in process_request
self.finish_request(request, client_address)
File "C:\Users\w\AppData\Local\Programs\Python\Python37\lib\socketserver.py", line 357, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\Users\w\AppData\Local\Programs\Python\Python37\lib\socketserver.py", line 717, in __init__
self.handle()
File "C:\Users\w\AppData\Local\Programs\Python\Python37\lib\wsgiref\simple_server.py", line 133, in handle
handler.run(self.server.get_app())
File "C:\Users\w\AppData\Local\Programs\Python\Python37\lib\wsgiref\handlers.py", line 144, in run
self.close()
File "C:\Users\w\AppData\Local\Programs\Python\Python37\lib\wsgiref\simple_server.py", line 35, in close
self.status.split(' ',1)[0], self.bytes_sent
AttributeError: 'NoneType' object has no attribute 'split'
----------------------------------------
http://www.lovean.com/mip/view-24-289296-0.html