Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
stefancon opened this issue Jan 7, 2019 · 7 comments

Comments

@stefancon
Copy link

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
Copy link

bertini36 commented Jan 10, 2019

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

@Silent743
Copy link
Contributor

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

@DaniilSezonov
Copy link
Contributor

I think that the problem related with commit (django/django@08f78a4)

@DaniilSezonov
Copy link
Contributor

@stefancon @bertini36 I think that i fixed the problem

@Ratak
Copy link

Ratak commented Apr 5, 2019

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
Copy link
Owner

jrief commented Apr 6, 2019

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.

gtnx added a commit that referenced this issue May 25, 2019
Add Django 2.1.5 and latest support.
@lahuindai
Copy link

lahuindai commented Aug 14, 2019

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 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants