Skip to content

wsgi.input _sock not working #41

Closed
gnocetti opened this Issue Mar 23, 2012 · 10 comments

3 participants

@gnocetti

I am having followin issue:

File "/usr/local/lib/python2.6/dist-packages/ws4py/server/wsgi/middleware.py", line 117, in call
environ.get('wsgi.input')._sock),
AttributeError: 'Input' object has no attribute '_sock'

I search Input class of pywsgi getevent and did not found _sock function.

@Lawouach
Owner

Which version of ws4py are you running?

@gnocetti
@Lawouach
Owner

Which version of gevent are you using?

@gnocetti
@Lawouach
Owner

stable? 0.13.6 or dev? 1.0.0? the more info you give me the more I could help :)

@gnocetti
@Lawouach
Owner

I'm a bit confused because:

  1. with the latest MASTER from a couple of days ago, the line you mention initially isn't where your error locates it.
  2. when using gevent you shouldn't be going through that code path you mention.

https://github.com/Lawouach/WebSocket-for-Python/blob/master/ws4py/server/wsgi/middleware.py#L123

Indeed when using gevent, the 'upgrade.socket' environ key is set which means you won't go through the other one.

Please:

1 Get once again the very last head from this repository

  1. make sure to explain to me what you're doing to get to that error
  2. Be as a precise as possible if you want me to help and copy/paste the exception you'd get.
@thebaron88

I have the same thing, did a pip install of gevent and for ws4py. I think pip installed ws4py 0.2.0 and gevent 0.13.6
I got the following.

Traceback (most recent call last):
File "/usr/lib/pymodules/python2.7/gevent/pywsgi.py", line 386, in handle_one_response
self.result = self.application(self.environ, self.start_response)
File "echo_gevent_server.py", line 64, in call
return self.ws(environ, start_response)
File "/usr/local/lib/python2.7/dist-packages/ws4py/server/wsgi/middleware.py", line 117, in call
environ.get('wsgi.input')._sock),
AttributeError: 'Input' object has no attribute '_sock'
: Failed to handle request:
request = GET /ws HTTP/1.1 from ('127.0.0.1', 42434)
application =

Downloaded gevent 1.0b1 and then got this

File "/usr/local/lib/python2.7/dist-packages/ws4py/server/wsgi/middleware.py", line 117, in call
environ.get('wsgi.input')._sock),
AttributeError: 'Input' object has no attribute '_sock'
{'GATEWAY_INTERFACE': 'CGI/1.1',
'HTTP_CONNECTION': 'Upgrade',
'HTTP_HOST': '127.0.0.1:9000',
'HTTP_ORIGIN': 'http://localhost:9000',
'HTTP_SEC_WEBSOCKET_KEY': 'BPBfXRxTOQp9vDk9o45LRA==',
'HTTP_SEC_WEBSOCKET_VERSION': '13',
'HTTP_UPGRADE': 'websocket',
'PATH_INFO': '/ws',
'QUERY_STRING': '',
'REMOTE_ADDR': '127.0.0.1',
'REQUEST_METHOD': 'GET',
'SCRIPT_NAME': '',
'SERVER_NAME': 'localhost',
'SERVER_PORT': '9000',
'SERVER_PROTOCOL': 'HTTP/1.0',
'SERVER_SOFTWARE': 'gevent/1.0 Python/2.7',
'upgrade.protocol': 'websocket',
'upgrade.socket': ,
'websocket.version': '13',
'wsgi.errors': ', mode 'w' at 0x7f83e0f7a270>,
'wsgi.input': ,
'wsgi.multiprocess': False,
'wsgi.multithread': False,
'wsgi.run_once': False,
'wsgi.url_scheme': 'http',
'wsgi.version': (1, 0)} failed with AttributeError

This is a pretty vanilla install of Linux Mint.

@thebaron88

I'll keep the error log there so people can find them.
The fix is as you mention, checkout and install head.
I believe that PyPi just needs updating.

@Lawouach
Owner

Well PyPi has only the last stable release. I have not yet released 0.2.1 which contains all the various fixes.

Thanks for trying it out.

@Lawouach Lawouach closed this Mar 27, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.