Thursday, June 20, 2019

[Urgent] 500 when requesting a file from browser.

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'
----------------------------------------






























--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAMMZq8N4RWSuPiFGKOB50HpjuNyCCToJYrfyrhObqAnB0dOmBA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment