jrief / django-websocket-redis

Websockets for Django applications using Redis as message queue
http://django-websocket-redis.awesto.com/
MIT License
897 stars 222 forks source link

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

Open stefancon opened 5 years ago

stefancon commented 5 years ago

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
bertini36 commented 5 years ago

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

Silent743 commented 5 years ago

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

DaniilSezonov commented 5 years ago

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

DaniilSezonov commented 5 years ago

@stefancon @bertini36 I think that i fixed the problem

Ratak commented 5 years ago

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

jrief commented 5 years ago

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.

lahuindai commented 5 years ago

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 ?