[Urgent] 500 when requesting a file from browser.

32 views
Skip to first unread message

vineeth sagar

unread,
Jun 20, 2019, 5:16:49 AM6/20/19
to django...@googlegroups.com
I need to display images on canvas, so I have used the following snippet. The request is reaching the server but I get the following trace. Unable to make sense out of it, if any of you can help out, it would be great.

function getImage(file_name, num_pages) {
myimage = new Image();
            myimage.onload = function () {
                //console.log();
                alert("Vineeth");
                canvas.width = myimage.width;
                canvas.height = myimage.height;
                ctx.drawImage(myimage, 0, 0);
            }
            myimage.src = window.origin + "{% static '' %}" + file_name + "-" + '1.ppm';
            //window.origin + "{%static ''%}" + file_name + "-" + '1.ppm';
            console.log(myimage.src);
}

Folks, please have a look at this.

Error Traceback;

Traceback (most recent call last):
  File "/usr/lib/python3.6/wsgiref/handlers.py", line 138, in run
    self.finish_response()
  File "/usr/lib/python3.6/wsgiref/handlers.py", line 180, in finish_response
    self.write(data)
  File "/usr/lib/python3.6/wsgiref/handlers.py", line 279, in write
    self._write(data)
  File "/usr/lib/python3.6/wsgiref/handlers.py", line 453, in _write
    result = self.stdout.write(data)
  File "/usr/lib/python3.6/socketserver.py", line 800, in write
    self._sock.sendall(b)
ConnectionResetError: [Errno 104] Connection reset by peer
[20/Jun/2019 09:10:11] "GET /static/f7cae2dc-ac60-4ec4-b562-4a4dafb3946d-1.ppm HTTP/1.1" 500 59
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 41614)
[20/Jun/2019 09:10:11] "GET /favicon.ico HTTP/1.1" 200 45
Traceback (most recent call last):
  File "/usr/lib/python3.6/wsgiref/handlers.py", line 138, in run
    self.finish_response()
  File "/usr/lib/python3.6/wsgiref/handlers.py", line 180, in finish_response
    self.write(data)
  File "/usr/lib/python3.6/wsgiref/handlers.py", line 279, in write
    self._write(data)
  File "/usr/lib/python3.6/wsgiref/handlers.py", line 453, in _write
    result = self.stdout.write(data)
  File "/usr/lib/python3.6/socketserver.py", line 800, in write
    self._sock.sendall(b)
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/wsgiref/handlers.py", line 141, in run
    self.handle_error()
  File "/home/madeye/Desktop/WorkSpace/Annotate_Arch/lib/python3.6/site-packages/django/core/servers/basehttp.py", line 116, in handle_error
    super().handle_error()
  File "/usr/lib/python3.6/wsgiref/handlers.py", line 368, in handle_error
    self.finish_response()
  File "/usr/lib/python3.6/wsgiref/handlers.py", line 180, in finish_response
    self.write(data)
  File "/usr/lib/python3.6/wsgiref/handlers.py", line 274, in write
    self.send_headers()
  File "/usr/lib/python3.6/wsgiref/handlers.py", line 331, in send_headers
    if not self.origin_server or self.client_is_modern():
  File "/usr/lib/python3.6/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/lib/python3.6/socketserver.py", line 651, in process_request_thread
    self.finish_request(request, client_address)
  File "/usr/lib/python3.6/socketserver.py", line 361, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "/usr/lib/python3.6/socketserver.py", line 721, in __init__
    self.handle()
  File "/home/madeye/Desktop/WorkSpace/Annotate_Arch/lib/python3.6/site-packages/django/core/servers/basehttp.py", line 171, in handle
    self.handle_one_request()
  File "/home/madeye/Desktop/WorkSpace/Annotate_Arch/lib/python3.6/site-packages/django/core/servers/basehttp.py", line 194, in handle_one_request
    handler.run(self.server.get_app())
  File "/usr/lib/python3.6/wsgiref/handlers.py", line 144, in run
    self.close()
  File "/home/madeye/Desktop/WorkSpace/Annotate_Arch/lib/python3.6/site-packages/django/core/servers/basehttp.py", line 111, in close
    super().close()
  File "/usr/lib/python3.6/wsgiref/simple_server.py", line 35, in close
    self.status.split(' ',1)[0], self.bytes_sent
AttributeError: 'NoneType' object has no attribute 'split'
----------------------------------------






























Simon A

unread,
Jun 21, 2019, 4:10:36 AM6/21/19
to Django users
On the last part of your stacktrace, there is a section

File "/usr/lib/python3.6/wsgiref/simple_server.py", line 35, in close
   
self.status.split(' ',1)[0], self.bytes_sent



could you please check this line out? 

you can try to print what is self.status to check what it is trying to split
Reply all
Reply to author
Forward
0 new messages