Django "Yellow Page" errors not showing up in Chrome - python

I have Django v 1.6 stable and Python 2.7.5 64-bit. When I have an error occur in one of my views, a blank page is displayed in Chrome and the following traceback printed in my console:
Traceback (most recent call last):
File "C:\WinPython\python-2.7.5.amd64\lib\SocketServer.py", line 593, in proce
ss_request_thread
self.finish_request(request, client_address)
File "C:\WinPython\python-2.7.5.amd64\lib\SocketServer.py", line 334, in finis
h_request
self.RequestHandlerClass(request, client_address, self)
File "C:\WinPython\python-2.7.5.amd64\lib\site-packages\django-1.6-py2.7.egg\django\core\servers\basehttp.py", line 126, in __init__
super(WSGIRequestHandler, self).__init__(*args, **kwargs)
File "C:\WinPython\python-2.7.5.amd64\lib\SocketServer.py", line 651, in __ini
t__
self.finish()
File "C:\WinPython\python-2.7.5.amd64\lib\SocketServer.py", line 710, in finis
h
self.wfile.close()
File "C:\WinPython\python-2.7.5.amd64\lib\socket.py", line 279, in close
self.flush()
File "C:\WinPython\python-2.7.5.amd64\lib\socket.py", line 303, in flush
self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 10053] An established connection was aborted by the software in yo
ur host machine
However, when I use IE, the yellow error page displays as intended.

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]

Broken pipe errno32 LDAP Django

I'm currently trying to use my school's LDAP with a website built with Django. But i'm encountering an error that I'm not able to tackle.
When I am using my school's network the LDAP log in works perfectly on localhost. But when i am using an off-campus network the log-in doesn't work, even the admin login created when i've run manage.py for the first time doesn't work.
The terminal display's the following error each time i try to login :
Traceback (most recent call last):
File "/Users/Me/anaconda/lib/python2.7/wsgiref/handlers.py", line 86, in run
self.finish_response()
File "/Users/Me/anaconda/lib/python2.7/wsgiref/handlers.py", line 128, in finish_response
self.write(data)
File "/Users/Me/anaconda/lib/python2.7/wsgiref/handlers.py", line 212, in write
self.send_headers()
File "/Users/Me/anaconda/lib/python2.7/wsgiref/handlers.py", line 270, in send_headers
self.send_preamble()
File "/Users/Me/anaconda/lib/python2.7/wsgiref/handlers.py", line 194, in send_preamble
'Date: %s\r\n' % format_date_time(time.time())
File "/Users/Me/anaconda/lib/python2.7/socket.py", line 324, in write
self.flush()
File "/Users/Me/anaconda/lib/python2.7/socket.py", line 303, in flush
self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 32] Broken pipe
[28/Jan/2014 11:18:43] "POST /admin/ HTTP/1.1" 500 59
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 60538)
Traceback (most recent call last):
File "/Users/Me/anaconda/lib/python2.7/SocketServer.py", line 593, in process_request_thread
self.finish_request(request, client_address)
File "/Users/Me/anaconda/lib/python2.7/SocketServer.py", line 334, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/Users/Me/anaconda/lib/python2.7/site-packages/django/core/servers/basehttp.py", line 150, in __init__
super(WSGIRequestHandler, self).__init__(*args, **kwargs)
File "/Users/Me/anaconda/lib/python2.7/SocketServer.py", line 651, in __init__
self.finish()
File "/Users/Me/anaconda/lib/python2.7/SocketServer.py", line 710, in finish
self.wfile.close()
File "/Users/Me/anaconda/lib/python2.7/socket.py", line 279, in close
self.flush()
File "/Users/Me/anaconda/lib/python2.7/socket.py", line 303, in flush
self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 32] Broken pipe
----------------------------------------
Thank you very much for your help !
This is an issue with the Django devserver (you are running your website using it, which is not recommended at all for production websites).
Please see this ticket for more details:
According to many sources the 'Broken Pipe' is a normal browser quirk. For example, the browser reads from the socket and then decides that the image it's been reading apparently didn't change. The browser now this (forcefully) closes the connection because it does not need more data. The other end of this socket (the python runserver) now raises a socket exception telling the program that the client 'Broke the socket pipe'.
Short answer is: ignore this error since it's a known error and won't be fixed.
There is also this SO thread talking about this issue.

Python Bottle framework becoming non-responsive

I am having some problem with using python's Bottle framework(http://bottlepy.org/docs/dev/index.html) to host a webpage. It seems to work fine for certain period of time but now and then I get the following error and it fails to show the webpage. The script doesn't crash but the webpage becomes non responsive.
Any suggestions?
Traceback (most recent call last):
File "/usr/lib/python2.7/SocketServer.py", line 295, in _handle_request_noblock
self.process_request(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 321, in process_request
self.finish_request(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 334, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/lib/python2.7/SocketServer.py", line 651, in __init__
self.finish()
File "/usr/lib/python2.7/SocketServer.py", line 710, in finish
self.wfile.close()
File "/usr/lib/python2.7/socket.py", line 279, in close
self.flush()
File "/usr/lib/python2.7/socket.py", line 303, in flush
self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 32] Broken pipe
I also see the following error. But I'm guessing these occur if a request to a non-existent webpage/object is requested-
Traceback (most recent call last):
File "/usr/lib/python2.7/SocketServer.py", line 295, in _handle_request_noblock
self.process_request(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 321, in process_request
self.finish_request(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 334, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/lib/python2.7/SocketServer.py", line 649, in __init__
self.handle()
File "/usr/lib/python2.7/wsgiref/simple_server.py", line 116, in handle
self.raw_requestline = self.rfile.readline()
File "/usr/lib/python2.7/socket.py", line 447, in readline
data = self._sock.recv(self._rbufsize)
error: [Errno 104] Connection reset by peer
This question seems to be similar to How to prevent errno 32 broken pipe?
You received a SIGPIPE and this could be due to attempting to write to a closed socket. You could try to handle the exception with something like that:
except socket.error, e:
if isinstance(e.args, tuple):
print "Errno: %d" % e[0]
if e[0] == errno.EPIPE:
# Caught a peer disconnection
print "Remote host disconnected"

Why does requesting an HTML page crash my local Google App Engine server?

Why does requesting an HTML page crash my local Google App Engine server?
This only happens if it's the second or third time I do a request on Internet Explorer 9, and it is not a problem with other browsers.
This is very annoying as I have to restart my server all the time.
The error:
Traceback (most recent call last):
File "C:\Program Files\Python25\lib\SocketServer.py", line 222, in handle_request
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 54978)
self.process_request(request, client_address)
File "C:\Program Files\Python25\lib\SocketServer.py", line 241, in process_request
self.finish_request(request, client_address)
File "C:\Program Files\Python25\lib\SocketServer.py", line 254, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\google_appengine\google\appengine\tools\dev_appserver.py", line 3932, in __init__
BaseHTTPServer.BaseHTTPRequestHandler.__init__(self, *args, **kwargs)
File "C:\Program Files\Python25\lib\SocketServer.py", line 521, in __init__
self.handle()
File "C:\Program Files\Python25\lib\BaseHTTPServer.py", line 316, in handle
self.handle_one_request()
File "C:\Program Files\Python25\lib\BaseHTTPServer.py", line 310, in handle_one_request
method()
File "C:\google_appengine\google\appengine\tools\dev_appserver.py", line 3942, in do_GET
self._HandleRequest()
File "C:\google_appengine\google\appengine\tools\dev_appserver.py", line 4199, in _HandleRequest
raise e
error: (10053, 'Software caused connection abort')
----------------------------------------
I have experienced the same problems. The only thing which helps is to run devappserver with specified IP address of your computer instead of running it on localhost (which is default).
like this:
google_appengine\dev_appserver.py --address=192.168.1.33 myapp
Please can you confirm if it works?
I don't have IE9 but that seems to be like the same problem with Google Chrome:
https://groups.google.com/d/topic/google-appengine-python/0qJlx94aZAE/discussion
https://groups.google.com/forum/#!topic/http-archive-specification/hkdkGknbpdA

error: [Errno 32] Broken pipe when paypal calls back to python django app

Hi I am doing papal integration with my django app.
i am using latest version of django from svn and python 2.6.
However, i found every time when paypal's sandbox accessing my notify url i got 500 [Errno 32] Broken pipe my django stack.
Does anyone have similar experience with this ?
Cheers,
Traceback (most recent call last):
File "/usr/lib/python2.6/dist-packages/django/core/servers/basehttp.py", line 281, in run
self.finish_response()
File "/usr/lib/python2.6/dist-packages/django/core/servers/basehttp.py", line 321, in finish_response
self.write(data)
File "/usr/lib/python2.6/dist-packages/django/core/servers/basehttp.py", line 417, in write
self._write(data)
File "/usr/lib/python2.6/socket.py", line 318, in write
self.flush()
File "/usr/lib/python2.6/socket.py", line 297, in flush
self._sock.sendall(buffer(data, write_offset, buffer_size))
error: [Errno 104] Connection reset by peer
----------------------------------------
Exception happened during processing of request from ('216.113.191.33', 21736)
Traceback (most recent call last):
File "/usr/lib/python2.6/SocketServer.py", line 283, in _handle_request_noblock
self.process_request(request, client_address)
File "/usr/lib/python2.6/SocketServer.py", line 309, in process_request
self.finish_request(request, client_address)
File "/usr/lib/python2.6/SocketServer.py", line 322, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/lib/python2.6/dist-packages/django/core/servers/basehttp.py", line 562, in __init__
BaseHTTPRequestHandler.__init__(self, *args, **kwargs)
File "/usr/lib/python2.6/SocketServer.py", line 618, in __init__
self.finish()
File "/usr/lib/python2.6/SocketServer.py", line 661, in finish
self.wfile.flush()
File "/usr/lib/python2.6/socket.py", line 297, in flush
self._sock.sendall(buffer(data, write_offset, buffer_size))
error: [Errno 32] Broken pipe
----------------------------------------
The first error Connection reset by peer show you that the connection have been closed by peer (in your case Pypal) and for the Error Broken pipe this error is raised when a connection is closed suddenly without informing the other peer (in your case your machine).
There are two problems. First, some of the paypal APIs (particularly MassPay) are terribly poor.
The second, and more likely, problem, is that your server is single-threaded and is having trouble properly raising an exception to paypal. I was able to resolve a similar problem by creating an html file with a form (via POST) that mocked a paypal IPN and then looking at the debug result (or better, using a debugger like the one in PyDev). You could do the same thing with curl of course.

Categories