I am having some trouble with connection errors in my Django app when a user navigates to a different page before AJAX call is finished.
So, when the client-side sends several AJAX calls for save/load/retrieve data etc., and when a user navigates to a different page - say when an AJAX call was just made from the client side to save the content, the content is saved and the functionally everything is fine, but I keep getting this error:
Exception happened during processing of request from ('127.0.0.1', 50646)
Traceback (most recent call last):
File "D:\Applications\WinPython-64bit-3.5.3.1Qt5\python-3.5.3.amd64\lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "D:\Applications\WinPython-64bit-3.5.3.1Qt5\python-3.5.3.amd64\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "D:\Applications\WinPython-64bit-3.5.3.1Qt5\python-3.5.3.amd64\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "D:\Applications\WinPython-64bit-3.5.3.1Qt5\python-3.5.3.amd64\lib\wsgiref\handlers.py", line 332, in send_headers
self.send_preamble()
File "D:\Applications\WinPython-64bit-3.5.3.1Qt5\python-3.5.3.amd64\lib\wsgiref\handlers.py", line 255, in send_preamble
('Date: %s\r\n' % format_date_time(time.time())).encode('iso-8859-1')
File "D:\Applications\WinPython-64bit-3.5.3.1Qt5\python-3.5.3.amd64\lib\wsgiref\handlers.py", line 453, in _write
result = self.stdout.write(data)
File "D:\Applications\WinPython-64bit-3.5.3.1Qt5\python-3.5.3.amd64\lib\socket.py", line 594, in write
return self._sock.send(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 "D:\Applications\WinPython-64bit-3.5.3.1Qt5\python-3.5.3.amd64\lib\wsgiref\handlers.py", line 141, in run
self.handle_error()
File "D:\Applications\WinPython-64bit-3.5.3.1Qt5\python-3.5.3.amd64\lib\site-packages\django\core\servers\basehttp.py", line 88, in handle_error
super(ServerHandler, self).handle_error()
File "D:\Applications\WinPython-64bit-3.5.3.1Qt5\python-3.5.3.amd64\lib\wsgiref\handlers.py", line 368, in handle_error
self.finish_response()
File "D:\Applications\WinPython-64bit-3.5.3.1Qt5\python-3.5.3.amd64\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "D:\Applications\WinPython-64bit-3.5.3.1Qt5\python-3.5.3.amd64\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "D:\Applications\WinPython-64bit-3.5.3.1Qt5\python-3.5.3.amd64\lib\wsgiref\handlers.py", line 331, in send_headers
if not self.origin_server or self.client_is_modern():
File "D:\Applications\WinPython-64bit-3.5.3.1Qt5\python-3.5.3.amd64\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 "D:\Applications\WinPython-64bit-3.5.3.1Qt5\python-3.5.3.amd64\lib\socketserver.py", line 625, in process_request_thread
self.finish_request(request, client_address)
File "D:\Applications\WinPython-64bit-3.5.3.1Qt5\python-3.5.3.amd64\lib\socketserver.py", line 354, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "D:\Applications\WinPython-64bit-3.5.3.1Qt5\python-3.5.3.amd64\lib\socketserver.py", line 681, in __init__
self.handle()
File "D:\Applications\WinPython-64bit-3.5.3.1Qt5\python-3.5.3.amd64\lib\site-packages\django\core\servers\basehttp.py", line 155, in handle
handler.run(self.server.get_app())
File "D:\Applications\WinPython-64bit-3.5.3.1Qt5\python-3.5.3.amd64\lib\wsgiref\handlers.py", line 144, in run
self.close()
File "D:\Applications\WinPython-64bit-3.5.3.1Qt5\python-3.5.3.amd64\lib\wsgiref\simple_server.py", line 36, in close
self.status.split(' ',1)[0], self.bytes_sent
AttributeError: 'NoneType' object has no attribute 'split'
For example, an AJAX call for the URL /xyz/save/ is sent, and before its callback is executed on the client side, the user navigates to a URL /xyz/abc, I get the above error. I understand that the connection for /xyz/save/ is interrupted, how do I avoid this?
Related
I have a Django project which uses Django+Django Rest Framework+Djoser (token based auth).
The project runs perfectly and I am able to GET and POST desired data's with backend.
But a strange error hits the running terminal randomly after certain interval and during some GET /POST operation, it never cause work interruption as terminal do not stop running.
I have attached the minified error screenshot for the reference.
I am unable to identify the place of error/cause of error to debug.
complete error code as mention below:
[10/Jun/2020 00:01:19] "GET /media/tracks/Kalimba_FXkucKr.mp3 HTTP/1.1" 200 5382144
Traceback (most recent call last):
File "c:\users\dell\desktop\pythonfiles\Lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "c:\users\dell\desktop\pythonfiles\Lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "c:\users\dell\desktop\pythonfiles\Lib\wsgiref\handlers.py", line 279, in write
self._write(data)
File "c:\users\dell\desktop\pythonfiles\Lib\wsgiref\handlers.py", line 453, in _write
result = self.stdout.write(data)
File "c:\users\dell\desktop\pythonfiles\Lib\socketserver.py", line 796, in write
self._sock.sendall(b)
ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine
[10/Jun/2020 00:01:19] "GET /media/tracks/Kalimba_FXkucKr.mp3 HTTP/1.1" 500 59
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 55650)
Traceback (most recent call last):
File "c:\users\dell\desktop\pythonfiles\Lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "c:\users\dell\desktop\pythonfiles\Lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "c:\users\dell\desktop\pythonfiles\Lib\wsgiref\handlers.py", line 279, in write
self._write(data)
File "c:\users\dell\desktop\pythonfiles\Lib\wsgiref\handlers.py", line 453, in _write
result = self.stdout.write(data)
File "c:\users\dell\desktop\pythonfiles\Lib\socketserver.py", line 796, 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\dell\desktop\pythonfiles\Lib\wsgiref\handlers.py", line 141, in run
self.handle_error()
File "C:\djangorest\jun4\env\lib\site-packages\django\core\servers\basehttp.py", line 116, in handle_error
super().handle_error()
File "c:\users\dell\desktop\pythonfiles\Lib\wsgiref\handlers.py", line 368, in handle_error
self.finish_response()
File "c:\users\dell\desktop\pythonfiles\Lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "c:\users\dell\desktop\pythonfiles\Lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "c:\users\dell\desktop\pythonfiles\Lib\wsgiref\handlers.py", line 331, in send_headers
if not self.origin_server or self.client_is_modern():
File "c:\users\dell\desktop\pythonfiles\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\dell\desktop\pythonfiles\Lib\socketserver.py", line 647, in process_request_thread
self.finish_request(request, client_address)
File "c:\users\dell\desktop\pythonfiles\Lib\socketserver.py", line 357, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "c:\users\dell\desktop\pythonfiles\Lib\socketserver.py", line 717, in __init__
self.handle()
File "C:\djangorest\jun4\env\lib\site-packages\django\core\servers\basehttp.py", line 169, in handle
self.handle_one_request()
File "C:\djangorest\jun4\env\lib\site-packages\django\core\servers\basehttp.py", line 194, in handle_one_request
handler.run(self.server.get_app())
File "c:\users\dell\desktop\pythonfiles\Lib\wsgiref\handlers.py", line 144, in run
self.close()
File "C:\djangorest\jun4\env\lib\site-packages\django\core\servers\basehttp.py", line 111, in close
super().close()
File "c:\users\dell\desktop\pythonfiles\Lib\wsgiref\simple_server.py", line 35, in
close
self.status.split(' ',1)[0], self.bytes_sent
AttributeError: 'NoneType' object has no attribute 'split'
----------------------------------------
[10/Jun/2020 00:01:29] "GET /songs/ HTTP/1.1" 200 2211
I wrote the PUT request API to set the user password. I wrote so many views but I am not experiencing any issue like in below view function.
views.py
#api_view(['PUT'])
#permission_classes([])
def setForgotPasswordWithNewPassword(request):
data = request.data
print(data)
user = User.objects.get(username=data['username'])
secret_key = request.data['secretkey']
backend_secretkey = cache.get('reset_pwd_%s' % (data['username']))
if backend_secretkey:
if backend_secretkey == secret_key:
if user:
user.set_password(data['password'])
# print(user.password)
user.save()
return Response({"msg":"Your password has been successfully changed"},status=200)
else:
return Response({"error":"Username does not exist on our system"},status=403)
else:
return Response({"error": "Your not authorized to use this link"}, status=403)
else:
return Response({"error": "Your password link has been expired, please try again"}, status=403)
Using Postman I am not getting any Exception on command line. but when I am hitting this API using my Angular project getting the below exception and due this exception wsgi server loaded again so angular loaded to again front page. But changing password working. so I am curious to know about this error which I am experiencing.
error:
[15/Jun/2020 00:34:01] "PUT /api/setForgotPasswordWithNewPwd/ HTTP/1.1" 200 53
Traceback (most recent call last):
File "C:\Users\vipin\AppData\Local\Programs\Python\Python36\lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "C:\Users\vipin\AppData\Local\Programs\Python\Python36\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Users\vipin\AppData\Local\Programs\Python\Python36\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "C:\Users\vipin\AppData\Local\Programs\Python\Python36\lib\wsgiref\handlers.py", line 332, in send_headers
self.send_preamble()
File "C:\Users\vipin\AppData\Local\Programs\Python\Python36\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\vipin\AppData\Local\Programs\Python\Python36\lib\wsgiref\handlers.py", line 453, in _write
result = self.stdout.write(data)
File "C:\Users\vipin\AppData\Local\Programs\Python\Python36\lib\socketserver.py", line 803, in write
self._sock.sendall(b)
ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine
[15/Jun/2020 00:34:01] "PUT /api/setForgotPasswordWithNewPwd/ HTTP/1.1" 500 59
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 49954)
Traceback (most recent call last):
File "C:\Users\vipin\AppData\Local\Programs\Python\Python36\lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "C:\Users\vipin\AppData\Local\Programs\Python\Python36\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Users\vipin\AppData\Local\Programs\Python\Python36\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "C:\Users\vipin\AppData\Local\Programs\Python\Python36\lib\wsgiref\handlers.py", line 332, in send_headers
self.send_preamble()
File "C:\Users\vipin\AppData\Local\Programs\Python\Python36\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\vipin\AppData\Local\Programs\Python\Python36\lib\wsgiref\handlers.py", line 453, in _write
result = self.stdout.write(data)
File "C:\Users\vipin\AppData\Local\Programs\Python\Python36\lib\socketserver.py", line 803, 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\vipin\AppData\Local\Programs\Python\Python36\lib\wsgiref\handlers.py", line 141, in run
self.handle_error()
File "C:\Users\vipin\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\servers\basehttp.py", line 119, in handle_error
super().handle_error()
File "C:\Users\vipin\AppData\Local\Programs\Python\Python36\lib\wsgiref\handlers.py", line 368, in handle_error
self.finish_response()
File "C:\Users\vipin\AppData\Local\Programs\Python\Python36\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Users\vipin\AppData\Local\Programs\Python\Python36\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "C:\Users\vipin\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\vipin\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\vipin\AppData\Local\Programs\Python\Python36\lib\socketserver.py", line 654, in process_request_thread
self.finish_request(request, client_address)
File "C:\Users\vipin\AppData\Local\Programs\Python\Python36\lib\socketserver.py", line 364, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\Users\vipin\AppData\Local\Programs\Python\Python36\lib\socketserver.py", line 724, in __init__
self.handle()
File "C:\Users\vipin\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\servers\basehttp.py", line 174, in handle
self.handle_one_request()
File "C:\Users\vipin\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\servers\basehttp.py", line 197, in handle_one_request
handler.run(self.server.get_app())
File "C:\Users\vipin\AppData\Local\Programs\Python\Python36\lib\wsgiref\handlers.py", line 144, in run
self.close()
File "C:\Users\vipin\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\servers\basehttp.py", line 114, in close
super().close()
File "C:\Users\vipin\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'
Using Postman tool calling not getting any Exception like above
My Angular calling:
setForgotPassword(data):Observable<any>{
return this.http.put<any>(this._base_url+this._setForgotPassword_url,data)
}
Typescript:
setPassword(secretkey){
this.data.secretkey = secretkey
console.log(this.data)
this.usr_srv.setForgotPassword(this.data).subscribe(
res => {
console.log(res)
// let dialogRef = this.dialog.open(DialogDataExampleDialog,{
// data: {msg: 'Your password has been successfully set',color:"green"}
// });
// dialogRef.afterClosed().subscribe(result => {
// this._router.navigate(['/login'])
// });
},
err =>{
console.log(err)
// let dialogRef = this.dialog.open(DialogDataExampleDialog,{
// data: {msg: err.error.error,color:"red"}
// });
// dialogRef.afterClosed().subscribe(result => {
// this._router.navigate(['/login'])
// });
}
)
}
I'm sending a mail with pdf attached in my application but at the receiver end can receive only the body not the attachment
This is the error I received while running the script but the mail is sent
Traceback (most recent call last):
File "C:\Users\vineet\AppData\Local\Programs\Python\Python37\lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "C:\Users\vineet\AppData\Local\Programs\Python\Python37\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Users\vineet\AppData\Local\Programs\Python\Python37\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "C:\Users\vineet\AppData\Local\Programs\Python\Python37\lib\wsgiref\handlers.py", line 332, in send_headers
self.send_preamble()
File "C:\Users\vineet\AppData\Local\Programs\Python\Python37\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\vineet\AppData\Local\Programs\Python\Python37\lib\wsgiref\handlers.py", line 453, in _write
result = self.stdout.write(data)
File "C:\Users\vineet\AppData\Local\Programs\Python\Python37\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\vineet\AppData\Local\Programs\Python\Python37\lib\wsgiref\handlers.py", line 141, in run
self.handle_error()
File "C:\Result Creater\virtual\lib\site-packages\django\core\servers\basehttp.py", line 116, in handle_error
super().handle_error()
File "C:\Users\vineet\AppData\Local\Programs\Python\Python37\lib\wsgiref\handlers.py", line 368, in handle_error
self.finish_response()
File "C:\Users\vineet\AppData\Local\Programs\Python\Python37\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Users\vineet\AppData\Local\Programs\Python\Python37\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "C:\Users\vineet\AppData\Local\Programs\Python\Python37\lib\wsgiref\handlers.py", line 331, in send_headers
if not self.origin_server or self.client_is_modern():
File "C:\Users\vineet\AppData\Local\Programs\Python\Python37\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\vineet\AppData\Local\Programs\Python\Python37\lib\socketserver.py", line 650, in process_request_thread
self.finish_request(request, client_address)
File "C:\Users\vineet\AppData\Local\Programs\Python\Python37\lib\socketserver.py", line 360, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\Users\vineet\AppData\Local\Programs\Python\Python37\lib\socketserver.py", line 720, in __init__
self.handle()
File "C:\Result Creater\virtual\lib\site-packages\django\core\servers\basehttp.py", line 171, in handle
self.handle_one_request()
File "C:\Result Creater\virtual\lib\site-packages\django\core\servers\basehttp.py", line 194, in handle_one_request
handler.run(self.server.get_app())
File "C:\Users\vineet\AppData\Local\Programs\Python\Python37\lib\wsgiref\handlers.py", line 144, in run
self.close()
File "C:\Result Creater\virtual\lib\site-packages\django\core\servers\basehttp.py", line 111, in close
super().close()
File "C:\Users\vineet\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'
My send email function-
def send_email(request):
subject='Mark Sheet'
message='You requested for your Marksheet'
email_from=settings.EMAIL_HOST_USER
recipient_list=[request.user.email]
email=EmailMessage(subject,message,email_from,recipient_list,
headers={'Reply- To':settings.EMAIL_HOST_USER})
file=str(request.user)+'.pdf'
email.attach_file=(f"/store/{file}")
email.send()
return redirect('home')
My Pdf class for creating pdf
class Pdf(View):
def get(self,request):
marks=Marks.objects.filter(user_name=request.user).first()
today=timezone.now()
params={
'today':today,
'marks':marks,
'request':request
}
file=Render.render_to_file('user/pdf.html',params)
return redirect('send_email')
You have bad syntax here:
email.attach_file=(f"/store/{file}")
attach_file() is a method, and you're assigning to it with = which means the method gets replaced on the object instead of being called. Change it to:
email.attach_file(f"/store/{file}")
My project in django 2.0, python 3.x and I think its when i go into django admin I get this series of trackbacks and red letters that I assume is some kind of error, i just have no idea whatsoever what it is.
ERROR does nothing:ERROR does nothing:
Traceback (most recent call last): File "C:\Users\Andre\Anaconda3\lib\wsgiref\handlers.py", line 138, in run
self.finish_response() File "C:\Users\Andre\Anaconda3\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data) File "C:\Users\Andre\Anaconda3\lib\wsgiref\handlers.py", line 274, in write
self.send_headers() File "C:\Users\Andre\Anaconda3\lib\wsgiref\handlers.py", line 332, in send_headers
self.send_preamble() File "C:\Users\Andre\Anaconda3\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\Andre\Anaconda3\lib\wsgiref\handlers.py", line 453, in
_write
result = self.stdout.write(data) File "C:\Users\Andre\Anaconda3\lib\socketserver.py", line 775, in write
self._sock.sendall(b) ConnectionAbortedError: [WinError 10053] Se ha anulado una conexión establecida por el software en su equipo host [30/May/2018 14:06:28] "GET /static/admin/css/changelists.css HTTP/1.1" 500 59
---------------------------------------- Exception happened during processing of request from ('127.0.0.1', 61210) [30/May/2018 14:06:28] "GET /static/admin/js/jquery.init.js HTTP/1.1" 200 363 Traceback (most recent call last): File "C:\Users\Andre\Anaconda3\lib\wsgiref\handlers.py", line 138, in run
self.finish_response() File "C:\Users\Andre\Anaconda3\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data) File "C:\Users\Andre\Anaconda3\lib\wsgiref\handlers.py", line 274, in write
self.send_headers() File "C:\Users\Andre\Anaconda3\lib\wsgiref\handlers.py", line 332, in send_headers
self.send_preamble() File "C:\Users\Andre\Anaconda3\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\Andre\Anaconda3\lib\wsgiref\handlers.py", line 453, in
_write
result = self.stdout.write(data) File "C:\Users\Andre\Anaconda3\lib\socketserver.py", line 775, in write
self._sock.sendall(b) ConnectionAbortedError: [WinError 10053] Se ha anulado una conexión establecida por el software en su equipo host
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "C:\Users\Andre\Anaconda3\lib\wsgiref\handlers.py", line 141, in run
self.handle_error() File "C:\Users\Andre\Desktop\Django_projects\Pycharm\Interpretes\lib\site-packages\django\core\servers\basehttp.py", line 86, in handle_error
super().handle_error() File "C:\Users\Andre\Anaconda3\lib\wsgiref\handlers.py", line 368, in handle_error
self.finish_response() File "C:\Users\Andre\Anaconda3\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data) File "C:\Users\Andre\Anaconda3\lib\wsgiref\handlers.py", line 274, in write
self.send_headers() File "C:\Users\Andre\Anaconda3\lib\wsgiref\handlers.py", line 331, in send_headers
if not self.origin_server or self.client_is_modern(): File "C:\Users\Andre\Anaconda3\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\Andre\Anaconda3\lib\socketserver.py", line 639, in process_request_thread
self.finish_request(request, client_address) File "C:\Users\Andre\Anaconda3\lib\socketserver.py", line 361, in finish_request
self.RequestHandlerClass(request, client_address, self) File "C:\Users\Andre\Anaconda3\lib\socketserver.py", line 696, in __init__
self.handle() File "C:\Users\Andre\Desktop\Django_projects\Pycharm\Interpretes\lib\site-packages\django\core\servers\basehttp.py", line 154, in handle
handler.run(self.server.get_app()) File "C:\Users\Andre\Anaconda3\lib\wsgiref\handlers.py", line 144, in run
self.close() File "C:\Users\Andre\Anaconda3\lib\wsgiref\simple_server.py", line 35, in close
self.status.split(' ',1)[0], self.bytes_sent AttributeError: 'NoneType' object has no attribute 'split'
It apparently does nothing but scare the hell out of me, if anyone has any thoughts please enlighten me.
I think it may or may not stop the server from running but i am not sure as I run it in a ec2 instance from AWS and in my IDE pycharm the console gets full of this.
You have an environment variable named SERVER_PROTOCOL that is not set.
Try giving it a value such as HTTP/0.9.
This will only fix this error. Not sure if there are other errors as well.
Setting environment variables in Windows PowerShell:
setx SERVER_PROTOCOL "HTTP/0.9"
And restart and command prompt.
I am using Python 3.6.0 + django 1.11 + windows 7 64 bit
my website is running fine but I am keep getting this errors.
ConnectionAbortedError: [WinError 10053] An established connection was
aborted by the software in your host machine
TypeError: 'NoneType' object is not subscriptable
AttributeError: 'NoneType' object has no attribute 'split'
Why i am getting this ..? and how to fix these errors ?
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 274, in write
self.send_headers()
File "C:\Python36\lib\wsgiref\handlers.py", line 332, in send_headers
self.send_preamble()
File "C:\Python36\lib\wsgiref\handlers.py", line 255, in send_preamble
('Date: %s\r\n' % format_date_time(time.time())).encode('iso-8859-1')
File "C:\Python36\lib\wsgiref\handlers.py", line 453, in _write
result = self.stdout.write(data)
File "C:\Python36\lib\socketserver.py", line 775, in write
self._sock.sendall(b)
ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine
[18/Sep/2017 12:25:10] "GET /api/dashboard/workorder_list/6/?format=json&_=1505708684218 HTTP/1.1" 500 59
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 32251)
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 274, in write
self.send_headers()
File "C:\Python36\lib\wsgiref\handlers.py", line 332, in send_headers
self.send_preamble()
File "C:\Python36\lib\wsgiref\handlers.py", line 255, in send_preamble
('Date: %s\r\n' % format_date_time(time.time())).encode('iso-8859-1')
File "C:\Python36\lib\wsgiref\handlers.py", line 453, in _write
result = self.stdout.write(data)
File "C:\Python36\lib\socketserver.py", line 775, 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 "C:\Python36\lib\site-packages\django\core\servers\basehttp.py", line 88, in handle_error
super(ServerHandler, self).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 639, 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 696, in __init__
self.handle()
File "C:\Python36\lib\site-packages\django\core\servers\basehttp.py", line 155, in handle
handler.run(self.server.get_app())
File "C:\Python36\lib\wsgiref\handlers.py", line 144, in run
self.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'
----------------------------------------
This has now been fixed in Python: https://github.com/python/cpython/pull/9713
It will be available in the next version of Python 3.7 and later.