django-websocket-redis icon indicating copy to clipboard operation
django-websocket-redis copied to clipboard

Exception: 'LimitedStream' object has no attribute 'raw' when using Django 2.1.5

Open stefancon opened this issue 6 years ago • 7 comments

Using Django 2.1.5 I get the following exception:

Other Exception: 'LimitedStream' object has no attribute 'raw'
Traceback (most recent call last):
  File "/home/stefan/plexmap/plexmap-dev/venv/lib/python3.5/site-packages/ws4redis/wsgi_server.py", line 113, in __call__
    websocket = self.upgrade_websocket(environ, start_response)
  File "/home/stefan/plexmap/plexmap-dev/venv/lib/python3.5/site-packages/ws4redis/django_runserver.py", line 97, in upgrade_websocket
    return WebSocket(environ['wsgi.input'])
  File "/home/stefan/plexmap/plexmap-dev/venv/lib/python3.5/site-packages/ws4redis/websocket.py", line 29, in __init__
    self.stream = Stream(wsgi_input)
  File "/home/stefan/plexmap/plexmap-dev/venv/lib/python3.5/site-packages/ws4redis/websocket.py", line 296, in __init__
    self.read = wsgi_input.raw._sock.recv

stefancon avatar Jan 07 '19 12:01 stefancon

Same problem here. Do you find something about it @stefancon ?

bertini36 avatar Jan 10 '19 11:01 bertini36

I have same problem too.Have anybody idea about fixing it without downgrade Django?

Silent743 avatar Jan 31 '19 12:01 Silent743

I think that the problem related with commit (https://github.com/django/django/commit/08f78a4fc8e7882f9fcad19aa6d497f749a9d261)

DaniilSezonov avatar Jan 31 '19 15:01 DaniilSezonov

@stefancon @bertini36 I think that i fixed the problem

DaniilSezonov avatar Feb 01 '19 12:02 DaniilSezonov

Still get the same error

Other Exception: 'LimitedStream' object has no attribute 'raw' Traceback (most recent call last): File "/home/user/.venv/lib/python3.6/site-packages/ws4redis/wsgi_server.py", line 113, in call websocket = self.upgrade_websocket(environ, start_response) File "/home/user/.venv/lib/python3.6/site-packages/ws4redis/django_runserver.py", line 97, in upgrade_websocket return WebSocket(environ['wsgi.input']) File "/home/user/.venv/lib/python3.6/site-packages/ws4redis/websocket.py", line 29, in init self.stream = Stream(wsgi_input) File "/home/user/.venv/lib/python3.6/site-packages/ws4redis/websocket.py", line 296, in init self.read = wsgi_input.raw._sock.recv

with the next one

AttributeError: 'LimitedStream' object has no attribute 'raw' Starting late response on websocket Traceback (most recent call last): File "/home/user/.pyenv/versions/3.6.7/lib/python3.6/wsgiref/handlers.py", line 137, in run self.result = application(self.environ, self.start_response) File "/home/user/.venv/lib/python3.6/site-packages/django/contrib/staticfiles/handlers.py", line 65, in call return self.application(environ, start_response) File "/home/user/.venv/lib/python3.6/site-packages/ws4redis/django_runserver.py", line 125, in application return _websocket_app(environ, start_response) File "/home/user/.venv/lib/python3.6/site-packages/ws4redis/wsgi_server.py", line 177, in call start_response(force_str(status), headers) File "/home/user/.pyenv/versions/3.6.7/lib/python3.6/wsgiref/handlers.py", line 223, in start_response raise AssertionError("Headers already set!") AssertionError: Headers already set!

It seems I do something wrong but I cannot guess what

Ratak avatar Apr 05 '19 13:04 Ratak

I never tested this library on Django-2 or later, so please be patient until I have some time to do so, or try yourself.

jrief avatar Apr 06 '19 06:04 jrief

2019-08-14 04:39:54,382 django.request ERROR Other Exception: 'LimitedStream' object has no attribute 'raw' Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/ws4redis/wsgi_server.py", line 113, in call websocket = self.upgrade_websocket(environ, start_response) File "/usr/local/lib/python3.6/dist-packages/ws4redis/django_runserver.py", line 97, in upgrade_websocket return WebSocket(environ['wsgi.input']) File "/usr/local/lib/python3.6/dist-packages/ws4redis/websocket.py", line 29, in init self.stream = Stream(wsgi_input) File "/usr/local/lib/python3.6/dist-packages/ws4redis/websocket.py", line 296, in init self.read = wsgi_input.raw._sock.recv AttributeError: 'LimitedStream' object has no attribute 'raw' Starting late response on websocket

Followed by

2019-08-14 04:39:54,383 django.request WARNING Starting late response on websocket Traceback (most recent call last): File "/usr/lib/python3.6/wsgiref/handlers.py", line 137, in run self.result = application(self.environ, self.start_response) File "/usr/local/lib/python3.6/dist-packages/django/contrib/staticfiles/handlers.py", line 65, in call return self.application(environ, start_response) File "/usr/local/lib/python3.6/dist-packages/ws4redis/django_runserver.py", line 125, in application return _websocket_app(environ, start_response) File "/usr/local/lib/python3.6/dist-packages/ws4redis/wsgi_server.py", line 177, in call start_response(force_str(status), headers) File "/usr/lib/python3.6/wsgiref/handlers.py", line 223, in start_response raise AssertionError("Headers already set!") AssertionError: Headers already set!

With Django 2.2.4 and python 3.6.8 using the new code submitted above. Anybody else getting this ?

lahuindai avatar Aug 14 '19 04:08 lahuindai