Django: 503 Service Unavailable - python

Related:
I am total new to Python and its frameworks. Just trying some hands on Django after some Python fundamentals.
Problem:
Right now I am trying to run Django server after first installation. The server runs without any error but when I try to visit the web page I get 503 Service Unavailable Error on http://127.0.0.1:8000/ and the server shuts down automatically.
Server Runs but errors after request:
D:\Code\Outer_Dir>manage.py runserver
Validating models...
0 errors found
December 23, 2013 - 21:51:36
Django version 1.6.1, using settings 'mysite.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
^C
D:\Code\Outer_Dir>manage.py runserver
Validating models...
0 errors found
December 23, 2013 - 21:55:21
Django version 1.6.1, using settings 'mysite.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
[23/Dec/2013 21:55:26] "GET / HTTP/1.1" 200 1757
Traceback (most recent call last):
File "C:\Python33\lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "C:\Python33\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Python33\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "C:\Python33\lib\wsgiref\handlers.py", line 333, in send_headers
self._write(bytes(self.headers))
File "C:\Python33\lib\wsgiref\handlers.py", line 453, in _write
self.stdout.write(data)
File "C:\Python33\lib\socket.py", line 317, in write
return self._sock.send(b)
ConnectionResetError: [WinError 10054] An existing connection was forcibly close
d by the remote host
[23/Dec/2013 21:55:26] "GET / HTTP/1.1" 500 59
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 58251)
Traceback (most recent call last):
File "C:\Python33\lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "C:\Python33\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Python33\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "C:\Python33\lib\wsgiref\handlers.py", line 333, in send_headers
self._write(bytes(self.headers))
File "C:\Python33\lib\wsgiref\handlers.py", line 453, in _write
self.stdout.write(data)
File "C:\Python33\lib\socket.py", line 317, in write
return self._sock.send(b)
ConnectionResetError: [WinError 10054] An existing connection was forcibly close
d by the remote host
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Python33\lib\wsgiref\handlers.py", line 141, in run
self.handle_error()
File "C:\Python33\lib\wsgiref\handlers.py", line 368, in handle_error
self.finish_response()
File "C:\Python33\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Python33\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "C:\Python33\lib\wsgiref\handlers.py", line 331, in send_headers
if not self.origin_server or self.client_is_modern():
File "C:\Python33\lib\wsgiref\handlers.py", line 344, 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:\Python33\lib\socketserver.py", line 610, in process_request_thread
self.finish_request(request, client_address)
File "C:\Python33\lib\socketserver.py", line 345, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\Python33\lib\site-packages\django\core\servers\basehttp.py", line 126
, in __init__
super(WSGIRequestHandler, self).__init__(*args, **kwargs)
File "C:\Python33\lib\socketserver.py", line 666, in __init__
self.handle()
File "C:\Python33\lib\wsgiref\simple_server.py", line 126, in handle
handler.run(self.server.get_app())
File "C:\Python33\lib\wsgiref\handlers.py", line 144, in run
self.close()
File "C:\Python33\lib\wsgiref\simple_server.py", line 35, in close
self.status.split(' ',1)[0], self.bytes_sent
AttributeError: 'NoneType' object has no attribute 'split'
----------------------------------------
Traceback (most recent call last):
File "C:\Python33\lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "C:\Python33\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Python33\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "C:\Python33\lib\wsgiref\handlers.py", line 333, in send_headers
self._write(bytes(self.headers))
File "C:\Python33\lib\wsgiref\handlers.py", line 453, in _write
self.stdout.write(data)
File "C:\Python33\lib\socket.py", line 317, in write
return self._sock.send(b)
ConnectionResetError: [WinError 10054] An existing connection was forcibly close
d by the remote host
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 58252)
Traceback (most recent call last):
File "C:\Python33\lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "C:\Python33\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Python33\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "C:\Python33\lib\wsgiref\handlers.py", line 333, in send_headers
self._write(bytes(self.headers))
File "C:\Python33\lib\wsgiref\handlers.py", line 453, in _write
self.stdout.write(data)
File "C:\Python33\lib\socket.py", line 317, in write
return self._sock.send(b)
ConnectionResetError: [WinError 10054] An existing connection was forcibly close
d by the remote host
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Python33\lib\wsgiref\handlers.py", line 141, in run
self.handle_error()
File "C:\Python33\lib\wsgiref\handlers.py", line 368, in handle_error
self.finish_response()
File "C:\Python33\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Python33\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "C:\Python33\lib\wsgiref\handlers.py", line 331, in send_headers
if not self.origin_server or self.client_is_modern():
File "C:\Python33\lib\wsgiref\handlers.py", line 344, 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:\Python33\lib\socketserver.py", line 610, in process_request_thread
self.finish_request(request, client_address)
File "C:\Python33\lib\socketserver.py", line 345, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\Python33\lib\site-packages\django\core\servers\basehttp.py", line 126
, in __init__
super(WSGIRequestHandler, self).__init__(*args, **kwargs)
File "C:\Python33\lib\socketserver.py", line 666, in __init__
self.handle()
File "C:\Python33\lib\wsgiref\simple_server.py", line 126, in handle
handler.run(self.server.get_app())
File "C:\Python33\lib\wsgiref\handlers.py", line 144, in run
self.close()
File "C:\Python33\lib\wsgiref\simple_server.py", line 35, in close
self.status.split(' ',1)[0], self.bytes_sent
AttributeError: 'NoneType' object has no attribute 'split'

Related

django: Getting error AttributeError: 'NoneType' object has no attribute 'split' even when I am able to access the page [duplicate]

This question already has answers here:
Django ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine
(6 answers)
Closed 3 years ago.
I am getting below error while running command. However, page is opening but on command prompt below error is coming. I referred other stackflow pages where similar error is there but it didnt helped.
python manage.py runserver
Error:
Performing system checks...
System check identified no issues (0 silenced).
December 19, 2019 - 13:04:14
Django version 2.1.5, using settings 'first_project.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
[19/Dec/2019 13:04:19] "GET / HTTP/1.1" 200 2786
[19/Dec/2019 13:04:19] "GET /static/css/mystyle.css HTTP/1.1" 200 68
Not Found: /favicon.ico
[19/Dec/2019 13:04:19] "GET /favicon.ico HTTP/1.1" 404 2211
Traceback (most recent call last):
File "C:\Users\rishbans\Anaconda3\envs\DjangoProject\lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "C:\Users\rishbans\Anaconda3\envs\DjangoProject\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Users\rishbans\Anaconda3\envs\DjangoProject\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "C:\Users\rishbans\Anaconda3\envs\DjangoProject\lib\wsgiref\handlers.py", line 332, in send_headers
self.send_preamble()
File "C:\Users\rishbans\Anaconda3\envs\DjangoProject\lib\wsgiref\handlers.py", line 255, in send_preamble
('Date: %s\r\n' % format_date_time(time.time())).encode('iso-8859-1')
File "C:\Users\rishbans\Anaconda3\envs\DjangoProject\lib\wsgiref\handlers.py", line 453, in _write
result = self.stdout.write(data)
File "C:\Users\rishbans\Anaconda3\envs\DjangoProject\lib\socketserver.py", line 799, in write
self._sock.sendall(b)
ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine
[19/Dec/2019 13:04:19] "GET /favicon.ico HTTP/1.1" 500 59
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 52848)
Traceback (most recent call last):
File "C:\Users\rishbans\Anaconda3\envs\DjangoProject\lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "C:\Users\rishbans\Anaconda3\envs\DjangoProject\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Users\rishbans\Anaconda3\envs\DjangoProject\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "C:\Users\rishbans\Anaconda3\envs\DjangoProject\lib\wsgiref\handlers.py", line 332, in send_headers
self.send_preamble()
File "C:\Users\rishbans\Anaconda3\envs\DjangoProject\lib\wsgiref\handlers.py", line 255, in send_preamble
('Date: %s\r\n' % format_date_time(time.time())).encode('iso-8859-1')
File "C:\Users\rishbans\Anaconda3\envs\DjangoProject\lib\wsgiref\handlers.py", line 453, in _write
result = self.stdout.write(data)
File "C:\Users\rishbans\Anaconda3\envs\DjangoProject\lib\socketserver.py", line 799, in write
self._sock.sendall(b)
ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\rishbans\Anaconda3\envs\DjangoProject\lib\wsgiref\handlers.py", line 141, in run
self.handle_error()
File "C:\Users\rishbans\Anaconda3\envs\DjangoProject\lib\site-packages\django\core\servers\basehttp.py", line 116, in handle_error
super().handle_error()
File "C:\Users\rishbans\Anaconda3\envs\DjangoProject\lib\wsgiref\handlers.py", line 368, in handle_error
self.finish_response()
File "C:\Users\rishbans\Anaconda3\envs\DjangoProject\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Users\rishbans\Anaconda3\envs\DjangoProject\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "C:\Users\rishbans\Anaconda3\envs\DjangoProject\lib\wsgiref\handlers.py", line 331, in send_headers
if not self.origin_server or self.client_is_modern():
File "C:\Users\rishbans\Anaconda3\envs\DjangoProject\lib\wsgiref\handlers.py", line 344, 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\rishbans\Anaconda3\envs\DjangoProject\lib\socketserver.py", line 650, in process_request_thread
self.finish_request(request, client_address)
File "C:\Users\rishbans\Anaconda3\envs\DjangoProject\lib\socketserver.py", line 360, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\Users\rishbans\Anaconda3\envs\DjangoProject\lib\socketserver.py", line 720, in __init__
self.handle()
File "C:\Users\rishbans\Anaconda3\envs\DjangoProject\lib\site-packages\django\core\servers\basehttp.py", line 171, in handle
self.handle_one_request()
File "C:\Users\rishbans\Anaconda3\envs\DjangoProject\lib\site-packages\django\core\servers\basehttp.py", line 194, in handle_one_request
handler.run(self.server.get_app())
File "C:\Users\rishbans\Anaconda3\envs\DjangoProject\lib\wsgiref\handlers.py", line 144, in run
self.close()
File "C:\Users\rishbans\Anaconda3\envs\DjangoProject\lib\site-packages\django\core\servers\basehttp.py", line 111, in close
super().close()
File "C:\Users\rishbans\Anaconda3\envs\DjangoProject\lib\wsgiref\simple_server.py", line 35, in close
self.status.split(' ',1)[0], self.bytes_sent
AttributeError: 'NoneType' object has no attribute 'split'
Any idea, where I should look into it. Let me know if you need any specific file.
This simply means that self.status is somehow returning a None value. So insert a check and try like this:
if self.status != None:
self.status.split(' ',1)[0]

Django An existing connection was forcibly closed by the remote host

I am googling a lot to find the solution. Maybe this is windows or python bug. I am here for getting help. It is creating problem while debuging.
Traceback (most recent call last):
File "C:\Users\azad\AppData\Local\Programs\Python\Python36\lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "C:\Users\azad\AppData\Local\Programs\Python\Python36\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Users\azad\AppData\Local\Programs\Python\Python36\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "C:\Users\azad\AppData\Local\Programs\Python\Python36\lib\wsgiref\handlers.py", line 332, in send_headers
self.send_preamble()
File "C:\Users\azad\AppData\Local\Programs\Python\Python36\lib\wsgiref\handlers.py", line 258, in send_preamble
self._write(('Server: %s\r\n' % self.server_software).encode('iso-8859-1'))
File "C:\Users\azad\AppData\Local\Programs\Python\Python36\lib\wsgiref\handlers.py", line 453, in _write
result = self.stdout.write(data)
File "C:\Users\azad\AppData\Local\Programs\Python\Python36\lib\socketserver.py", line 803, in write
self._sock.sendall(b)
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host
[19/Apr/2019 14:31:19] ERROR [django.server:154] "GET /static/node_modules/metronic-theme-classic/assets/media/logos/favicon.ico HTTP/1.1" 500 59
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 52183)
Traceback (most recent call last):
File "C:\Users\azad\AppData\Local\Programs\Python\Python36\lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "C:\Users\azad\AppData\Local\Programs\Python\Python36\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Users\azad\AppData\Local\Programs\Python\Python36\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "C:\Users\azad\AppData\Local\Programs\Python\Python36\lib\wsgiref\handlers.py", line 332, in send_headers
self.send_preamble()
File "C:\Users\azad\AppData\Local\Programs\Python\Python36\lib\wsgiref\handlers.py", line 258, in send_preamble
self._write(('Server: %s\r\n' % self.server_software).encode('iso-8859-1'))
File "C:\Users\azad\AppData\Local\Programs\Python\Python36\lib\wsgiref\handlers.py", line 453, in _write
result = self.stdout.write(data)
File "C:\Users\azad\AppData\Local\Programs\Python\Python36\lib\socketserver.py", line 803, in write
self._sock.sendall(b)
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\azad\AppData\Local\Programs\Python\Python36\lib\wsgiref\handlers.py", line 141, in run
self.handle_error()
File "C:\Users\azad\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\servers\basehttp.py", line 116, in handle_error
super().handle_error()
File "C:\Users\azad\AppData\Local\Programs\Python\Python36\lib\wsgiref\handlers.py", line 368, in handle_error
self.finish_response()
File "C:\Users\azad\AppData\Local\Programs\Python\Python36\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Users\azad\AppData\Local\Programs\Python\Python36\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "C:\Users\azad\AppData\Local\Programs\Python\Python36\lib\wsgiref\handlers.py", line 331, in send_headers
if not self.origin_server or self.client_is_modern():
File "C:\Users\azad\AppData\Local\Programs\Python\Python36\lib\wsgiref\handlers.py", line 344, 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\azad\AppData\Local\Programs\Python\Python36\lib\socketserver.py", line 654, in process_request_thread
self.finish_request(request, client_address)
File "C:\Users\azad\AppData\Local\Programs\Python\Python36\lib\socketserver.py", line 364, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\Users\azad\AppData\Local\Programs\Python\Python36\lib\socketserver.py", line 724, in __init__
self.handle()
File "C:\Users\azad\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\servers\basehttp.py", line 171, in handle
self.handle_one_request()
File "C:\Users\azad\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\servers\basehttp.py", line 194, in handle_one_request
handler.run(self.server.get_app())
File "C:\Users\azad\AppData\Local\Programs\Python\Python36\lib\wsgiref\handlers.py", line 144, in run
self.close()
File "C:\Users\azad\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\servers\basehttp.py", line 111, in close
super().close()
File "C:\Users\azad\AppData\Local\Programs\Python\Python36\lib\wsgiref\simple_server.py", line 35, in close
self.status.split(' ',1)[0], self.bytes_sent
AttributeError: 'NoneType' object has no attribute 'split'
----------------------------------------
Traceback (most recent call last):
File "C:\Users\azad\AppData\Local\Programs\Python\Python36\lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "C:\Users\azad\AppData\Local\Programs\Python\Python36\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Users\azad\AppData\Local\Programs\Python\Python36\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "C:\Users\azad\AppData\Local\Programs\Python\Python36\lib\wsgiref\handlers.py", line 333, in send_headers
self._write(bytes(self.headers))
File "C:\Users\azad\AppData\Local\Programs\Python\Python36\lib\wsgiref\handlers.py", line 453, in _write
result = self.stdout.write(data)
File "C:\Users\azad\AppData\Local\Programs\Python\Python36\lib\socketserver.py", line 803, in write
self._sock.sendall(b)
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host
[19/Apr/2019 14:31:21] ERROR [django.server:154] "GET /static/node_modules/metronic-theme-classic/assets/media/logos/favicon.ico HTTP/1.1" 500 59
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 52185)
Traceback (most recent call last):
File "C:\Users\azad\AppData\Local\Programs\Python\Python36\lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "C:\Users\azad\AppData\Local\Programs\Python\Python36\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Users\azad\AppData\Local\Programs\Python\Python36\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "C:\Users\azad\AppData\Local\Programs\Python\Python36\lib\wsgiref\handlers.py", line 333, in send_headers
self._write(bytes(self.headers))
File "C:\Users\azad\AppData\Local\Programs\Python\Python36\lib\wsgiref\handlers.py", line 453, in _write
result = self.stdout.write(data)
File "C:\Users\azad\AppData\Local\Programs\Python\Python36\lib\socketserver.py", line 803, in write
self._sock.sendall(b)
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\azad\AppData\Local\Programs\Python\Python36\lib\wsgiref\handlers.py", line 141, in run
self.handle_error()
File "C:\Users\azad\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\servers\basehttp.py", line 116, in handle_error
super().handle_error()
File "C:\Users\azad\AppData\Local\Programs\Python\Python36\lib\wsgiref\handlers.py", line 368, in handle_error
self.finish_response()
File "C:\Users\azad\AppData\Local\Programs\Python\Python36\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Users\azad\AppData\Local\Programs\Python\Python36\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "C:\Users\azad\AppData\Local\Programs\Python\Python36\lib\wsgiref\handlers.py", line 331, in send_headers
if not self.origin_server or self.client_is_modern():
File "C:\Users\azad\AppData\Local\Programs\Python\Python36\lib\wsgiref\handlers.py", line 344, 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\azad\AppData\Local\Programs\Python\Python36\lib\socketserver.py", line 654, in process_request_thread
self.finish_request(request, client_address)
File "C:\Users\azad\AppData\Local\Programs\Python\Python36\lib\socketserver.py", line 364, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\Users\azad\AppData\Local\Programs\Python\Python36\lib\socketserver.py", line 724, in __init__
self.handle()
File "C:\Users\azad\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\servers\basehttp.py", line 171, in handle
self.handle_one_request()
File "C:\Users\azad\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\servers\basehttp.py", line 194, in handle_one_request
handler.run(self.server.get_app())
File "C:\Users\azad\AppData\Local\Programs\Python\Python36\lib\wsgiref\handlers.py", line 144, in run
self.close()
File "C:\Users\azad\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\servers\basehttp.py", line 111, in close
super().close()
File "C:\Users\azad\AppData\Local\Programs\Python\Python36\lib\wsgiref\simple_server.py", line 35, in close
self.status.split(' ',1)[0], self.bytes_sent
AttributeError: 'NoneType' object has no attribute 'split'

Getting error while playing uploaded audio file in Django

Here is the trace back of the error occurred
[17/Mar/2019 11:15:26] "GET /media/songs/Three_Days_Grace_-_Break.mp3
HTTP/1.1" 200 4579328
Traceback (most recent call last):
File "C:\Python36\lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "C:\Python36\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Python36\lib\wsgiref\handlers.py", line 279, in write
self._write(data)
File "C:\Python36\lib\wsgiref\handlers.py", line 453, in _write
result = self.stdout.write(data)
File "C:\Python36\lib\socketserver.py", line 800, in write
self._sock.sendall(b)
ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine
[17/Mar/2019 11:15:26] "GET /media/songs/Three_Days_Grace_-_Break.mp3 HTTP/1.1" 500 59
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 54509)
Traceback (most recent call last):
File "C:\Python36\lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "C:\Python36\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Python36\lib\wsgiref\handlers.py", line 279, in write
self._write(data)
File "C:\Python36\lib\wsgiref\handlers.py", line 453, in _write
result = self.stdout.write(data)
File "C:\Python36\lib\socketserver.py", line 800, in write
self._sock.sendall(b)
ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Python36\lib\wsgiref\handlers.py", line 141, in run
self.handle_error()
File "D:\Django Projects\Virtual Envs\lib\site-packages\django\core\servers\basehttp.py", line 116, in handle_error
super().handle_error()
File "C:\Python36\lib\wsgiref\handlers.py", line 368, in handle_error
self.finish_response()
File "C:\Python36\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Python36\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "C:\Python36\lib\wsgiref\handlers.py", line 331, in send_headers
if not self.origin_server or self.client_is_modern():
File "C:\Python36\lib\wsgiref\handlers.py", line 344, 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:\Python36\lib\socketserver.py", line 651, in process_request_thread
self.finish_request(request, client_address)
File "C:\Python36\lib\socketserver.py", line 361, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\Python36\lib\socketserver.py", line 721, in __init__
self.handle()
File "D:\Django Projects\Virtual Envs\lib\site-packages\django\core\servers\basehttp.py", line 171, in handle
self.handle_one_request()
File "D:\Django Projects\Virtual Envs\lib\site-packages\django\core\servers\basehttp.py", line 194, in handle_one_request
handler.run(self.server.get_app())
File "C:\Python36\lib\wsgiref\handlers.py", line 144, in run
self.close()
File "D:\Django Projects\Virtual Envs\lib\site-packages\django\core\servers\basehttp.py", line 111, in close
super().close()
File "C:\Python36\lib\wsgiref\simple_server.py", line 35, in close
self.status.split(' ',1)[0], self.bytes_sent
AttributeError: 'NoneType' object has no attribute 'split'
Note that I'm still able to play the audio file my template view, but I can't seek to a specific duration of this file. Any hints as to why this is happening ?
Here's my code for models.py :
class Song(models.Model):
song_name = models.CharField(max_length=100)
album_name = models.ForeignKey(Album, on_delete=models.CASCADE)
song_file = models.FileField(upload_to='songs/', null=True,
validators=[validate_song_extension])
def get_absolute_url(self):
return reverse('music:song-detail', kwargs={'pk': self.pk})
def __str__(self):
return self.song_name
I am using a simple CreateView to accept new entries for this Song model with no form_valid() method, is that the possible cause I'm getting this error ?

django:ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host

I am new to the programming and i have been trying to develop an audio player using jQuery/HTML5.The audio source to the jquery is being passed by AJAX response.The audio play is fine in my local host while using Laptop.But if i connect my smartphone and try to play the audio, i get the "ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host" error.
Can someone provide me a solution?.
Thanks in Advance
Exception details:
Traceback (most recent call last):
File "C:\Python35\lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "C:\Python35\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Python35\lib\wsgiref\handlers.py", line 279, in write
self._write(data)
File "C:\Python35\lib\wsgiref\handlers.py", line 453, in _write
self.stdout.write(data)
File "C:\Python35\lib\socket.py", line 593, in write
return self._sock.send(b)
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host
[18/Jul/2017 18:04:21] "GET /images/mpthreetest.mp3 HTTP/1.1" 500 59
Exception happened during processing of request from ('192.168.1.35', 33876)
Traceback (most recent call last):
File "C:\Python35\lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "C:\Python35\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Python35\lib\wsgiref\handlers.py", line 279, in write
self._write(data)
File "C:\Python35\lib\wsgiref\handlers.py", line 453, in _write
self.stdout.write(data)
File "C:\Python35\lib\socket.py", line 593, in write
return self._sock.send(b)
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Python35\lib\wsgiref\handlers.py", line 141, in run
self.handle_error()
File "C:\Python35\lib\site-packages\django\core\servers\basehttp.py", line 95, in handle_error
super(ServerHandler, self).handle_error()
File "C:\Python35\lib\wsgiref\handlers.py", line 368, in handle_error
self.finish_response()
File "C:\Python35\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Python35\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "C:\Python35\lib\wsgiref\handlers.py", line 331, in send_headers
if not self.origin_server or self.client_is_modern():
File "C:\Python35\lib\wsgiref\handlers.py", line 344, 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:\Python35\lib\socketserver.py", line 628, in process_request_thread
self.finish_request(request, client_address)
File "C:\Python35\lib\socketserver.py", line 357, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\Python35\lib\socketserver.py", line 684, in init
self.handle()
File "C:\Python35\lib\site-packages\django\core\servers\basehttp.py", line 174, in handle
handler.run(self.server.get_app())
File "C:\Python35\lib\wsgiref\handlers.py", line 144, in run
self.close()
File "C:\Python35\lib\wsgiref\simple_server.py", line 35, in close
self.status.split(' ',1)[0], self.bytes_sent
AttributeError: 'NoneType' object has no attribute 'split'

How do I solve NoneType object is not callable with BeautifulSoup and Bottle?

I have this code inside one of my routes in a small Bottle project:
#route('/method/')
def method():
import urllib.request
from bottle import response
response.content_type = 'text/xml'
opener = urllib.request.build_opener()
opener.addheaders = [('User-agent', 'Mozilla/5.0')]
r=opener.open('http://www.example.com/')
content = str(r.read())
soup = BeautifulSoup(content)
return soup.title
I have read similar questions. I've tried everything, but I'm always getting the same error. I don't even know if it's related with bottle.
I have used virtualenv to create an isolated environment with Python3. The version of BeautifulSoup is 4:
from bs4 import BeautifulSoup
I'm always getting the same, giant stacktraces of:
127.0.0.1 - - [24/Jan/2015 14:50:42] "GET /extract_web_information/ HTTP/1.1" 200 0
Traceback (most recent call last):
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 179, in finish_response
for data in self.result:
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/util.py", line 30, in __next__
data = self.filelike.read(self.blksize)
TypeError: 'NoneType' object is not callable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 138, in run
self.finish_response()
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 183, in finish_response
self.close()
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/simple_server.py", line 38, in close
SimpleHandler.close(self)
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 321, in close
self.result.close()
TypeError: 'NoneType' object is not callable
127.0.0.1 - - [24/Jan/2015 14:50:42] "GET /extract_web_information/ HTTP/1.1" 500 59
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 55533)
Traceback (most recent call last):
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 179, in finish_response
for data in self.result:
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/util.py", line 30, in __next__
data = self.filelike.read(self.blksize)
TypeError: 'NoneType' object is not callable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 138, in run
self.finish_response()
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 183, in finish_response
self.close()
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/simple_server.py", line 38, in close
SimpleHandler.close(self)
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 321, in close
self.result.close()
TypeError: 'NoneType' object is not callable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 141, in run
self.handle_error()
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 368, in handle_error
self.finish_response()
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 180, in finish_response
self.write(data)
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 274, in write
self.send_headers()
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 331, in send_headers
if not self.origin_server or self.client_is_modern():
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 344, 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 "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/socketserver.py", line 305, in _handle_request_noblock
self.process_request(request, client_address)
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/socketserver.py", line 331, in process_request
self.finish_request(request, client_address)
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/socketserver.py", line 344, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/socketserver.py", line 669, in __init__
self.handle()
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/simple_server.py", line 133, in handle
handler.run(self.server.get_app())
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 144, in run
self.close()
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/simple_server.py", line 35, in close
self.status.split(' ',1)[0], self.bytes_sent
AttributeError: 'NoneType' object has no attribute 'split'
----------------------------------------
127.0.0.1 - - [24/Jan/2015 14:50:42] "GET /extract_web_information/ HTTP/1.1" 200 0
Traceback (most recent call last):
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 179, in finish_response
for data in self.result:
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/util.py", line 30, in __next__
data = self.filelike.read(self.blksize)
TypeError: 'NoneType' object is not callable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 138, in run
self.finish_response()
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 183, in finish_response
self.close()
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/simple_server.py", line 38, in close
SimpleHandler.close(self)
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 321, in close
self.result.close()
TypeError: 'NoneType' object is not callable
127.0.0.1 - - [24/Jan/2015 14:50:42] "GET /extract_web_information/ HTTP/1.1" 500 59
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 55536)
Traceback (most recent call last):
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 179, in finish_response
for data in self.result:
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/util.py", line 30, in __next__
data = self.filelike.read(self.blksize)
TypeError: 'NoneType' object is not callable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 138, in run
self.finish_response()
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 183, in finish_response
self.close()
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/simple_server.py", line 38, in close
SimpleHandler.close(self)
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 321, in close
self.result.close()
TypeError: 'NoneType' object is not callable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 141, in run
self.handle_error()
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 368, in handle_error
self.finish_response()
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 180, in finish_response
self.write(data)
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 274, in write
self.send_headers()
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 331, in send_headers
if not self.origin_server or self.client_is_modern():
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 344, 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 "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/socketserver.py", line 305, in _handle_request_noblock
self.process_request(request, client_address)
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/socketserver.py", line 331, in process_request
self.finish_request(request, client_address)
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/socketserver.py", line 344, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/socketserver.py", line 669, in __init__
self.handle()
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/simple_server.py", line 133, in handle
handler.run(self.server.get_app())
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 144, in run
self.close()
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/simple_server.py", line 35, in close
self.status.split(' ',1)[0], self.bytes_sent
AttributeError: 'NoneType' object has no attribute 'split'
----------------------------------------
127.0.0.1 - - [24/Jan/2015 14:50:42] "GET /extract_web_information/ HTTP/1.1" 200 0
Traceback (most recent call last):
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 179, in finish_response
for data in self.result:
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/util.py", line 30, in __next__
data = self.filelike.read(self.blksize)
TypeError: 'NoneType' object is not callable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 138, in run
self.finish_response()
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 183, in finish_response
self.close()
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/simple_server.py", line 38, in close
SimpleHandler.close(self)
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 321, in close
self.result.close()
TypeError: 'NoneType' object is not callable
127.0.0.1 - - [24/Jan/2015 14:50:42] "GET /extract_web_information/ HTTP/1.1" 500 59
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 55539)
Traceback (most recent call last):
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 179, in finish_response
for data in self.result:
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/util.py", line 30, in __next__
data = self.filelike.read(self.blksize)
TypeError: 'NoneType' object is not callable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 138, in run
self.finish_response()
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 183, in finish_response
self.close()
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/simple_server.py", line 38, in close
SimpleHandler.close(self)
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 321, in close
self.result.close()
TypeError: 'NoneType' object is not callable
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 141, in run
self.handle_error()
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 368, in handle_error
self.finish_response()
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 180, in finish_response
self.write(data)
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 274, in write
self.send_headers()
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 331, in send_headers
if not self.origin_server or self.client_is_modern():
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 344, 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 "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/socketserver.py", line 305, in _handle_request_noblock
self.process_request(request, client_address)
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/socketserver.py", line 331, in process_request
self.finish_request(request, client_address)
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/socketserver.py", line 344, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/socketserver.py", line 669, in __init__
self.handle()
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/simple_server.py", line 133, in handle
handler.run(self.server.get_app())
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/handlers.py", line 144, in run
self.close()
File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/wsgiref/simple_server.py", line 35, in close
self.status.split(' ',1)[0], self.bytes_sent
AttributeError: 'NoneType' object has no attribute 'split'
----------------------------------------
How I'm running the server
source bin/activate
python myserver.py
After that, GET request from a browser
I have tested that the request is correctly made.
Thanks a lot,
Perhaps there is no <title>. To illustrate this, try replacing your code
return soup.title
with:
return soup.title or "no title found."

Categories