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

python3.5 not work #9

Open
dukelec opened this issue Oct 13, 2016 · 4 comments
Open

python3.5 not work #9

dukelec opened this issue Oct 13, 2016 · 4 comments

Comments

@dukelec
Copy link

dukelec commented Oct 13, 2016

duke@duke-uf /mnt/TT/p2p $ python3.5 ser.py 
Bottle v0.12.9 server starting up (using GeventWebSocketServer())...
Listening on http://127.0.0.1:8001/
Hit Ctrl-C to quit.

Traceback (most recent call last):
  File "/usr/lib64/python3.5/site-packages/gevent/greenlet.py", line 534, in run
    result = self._run(*self.args, **self.kwargs)
  File "/usr/lib64/python3.5/site-packages/gevent/baseserver.py", line 25, in _handle_and_close_when_done
    return handle(*args_tuple)
  File "/usr/lib64/python3.5/site-packages/gevent/pywsgi.py", line 1253, in handle
    handler.handle()
  File "/usr/lib64/python3.5/site-packages/gevent/pywsgi.py", line 443, in handle
    result = self.handle_one_request()
  File "/usr/lib64/python3.5/site-packages/gevent/pywsgi.py", line 658, in handle_one_request
    self.handle_one_response()
  File "/usr/lib64/python3.5/site-packages/gevent/pywsgi.py", line 916, in handle_one_response
    self.log_request()
  File "/usr/lib64/python3.5/site-packages/geventwebsocket/handler.py", line 236, in log_request
    if '101' not in self.status:
TypeError: a bytes-like object is required, not 'str'
<Greenlet at 0x7fe9fed65af8: _handle_and_close_when_done(<bound method WSGIServer.handle of <WSGIServer at , <bound method StreamServer.do_close of <WSGIServer, (<gevent._socket3.socket [closed]  object, fd=-1, )> failed with TypeError

Traceback (most recent call last):
  File "/usr/lib64/python3.5/site-packages/gevent/pywsgi.py", line 884, in handle_one_response
    self.run_application()
  File "/usr/lib64/python3.5/site-packages/geventwebsocket/handler.py", line 70, in run_application
    self.result = self.upgrade_websocket()
  File "/usr/lib64/python3.5/site-packages/geventwebsocket/handler.py", line 129, in upgrade_websocket
    return self.upgrade_connection()
  File "/usr/lib64/python3.5/site-packages/geventwebsocket/handler.py", line 219, in upgrade_connection
    hashlib.sha1(key + self.GUID).digest())),
TypeError: Unicode-objects must be encoded before hashing
{'GATEWAY_INTERFACE': 'CGI/1.1',
 'HTTP_ACCEPT_ENCODING': 'gzip, deflate, sdch',
 'HTTP_ACCEPT_LANGUAGE': 'zh-TW,zh;q=0.8,en-US;q=0.6,en;q=0.4',
 'HTTP_CACHE_CONTROL': 'no-cache',
 'HTTP_CONNECTION': 'Upgrade',
 'HTTP_HOST': '127.0.0.1:8001',
 'HTTP_ORIGIN': 'http://localhost:8001',
 'HTTP_PRAGMA': 'no-cache',
 'HTTP_SEC_WEBSOCKET_EXTENSIONS': 'permessage-deflate; client_max_window_bits',
 'HTTP_SEC_WEBSOCKET_KEY': 'GqFj9N4XhFEex2uEF7Xs/A==',
 'HTTP_SEC_WEBSOCKET_VERSION': '13',
 'HTTP_UPGRADE': 'websocket',
 'HTTP_USER_AGENT': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 '
                    '(KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36',
 'PATH_INFO': '/websocket',
 'QUERY_STRING': '',
 'REMOTE_ADDR': '127.0.0.1',
 'REMOTE_PORT': '38446',
 'REQUEST_METHOD': 'GET',
 'SCRIPT_NAME': '',
 'SERVER_NAME': 'localhost',
 'SERVER_PORT': '8001',
 'SERVER_PROTOCOL': 'HTTP/1.1',
 'SERVER_SOFTWARE': 'gevent/1.1 Python/3.5',
 'wsgi.errors': <_io.TextIOWrapper name='<stderr>' mode='w' encoding='UTF-8'>,
 'wsgi.input': <gevent.pywsgi.Input object at 0x7fe9fdc51948>,
 'wsgi.multiprocess': False,
 'wsgi.multithread': False,
 'wsgi.run_once': False,
 'wsgi.url_scheme': 'http',
 'wsgi.version': (1, 0),
 'wsgi.websocket': <geventwebsocket.websocket.WebSocket object at 0x7fe9fd7b1250>,
 'wsgi.websocket_version': '13'} failed with TypeError

Traceback (most recent call last):
  File "/usr/lib64/python3.5/site-packages/gevent/greenlet.py", line 534, in run
    result = self._run(*self.args, **self.kwargs)
  File "/usr/lib64/python3.5/site-packages/gevent/baseserver.py", line 25, in _handle_and_close_when_done
    return handle(*args_tuple)
  File "/usr/lib64/python3.5/site-packages/gevent/pywsgi.py", line 1253, in handle
    handler.handle()
  File "/usr/lib64/python3.5/site-packages/gevent/pywsgi.py", line 443, in handle
    result = self.handle_one_request()
  File "/usr/lib64/python3.5/site-packages/gevent/pywsgi.py", line 658, in handle_one_request
    self.handle_one_response()
  File "/usr/lib64/python3.5/site-packages/gevent/pywsgi.py", line 916, in handle_one_response
    self.log_request()
  File "/usr/lib64/python3.5/site-packages/geventwebsocket/handler.py", line 236, in log_request
    if '101' not in self.status:
TypeError: a bytes-like object is required, not 'str'
<Greenlet at 0x7fe9fdc55df0: _handle_and_close_when_done(<bound method WSGIServer.handle of <WSGIServer at , <bound method StreamServer.do_close of <WSGIServer, (<gevent._socket3.socket [closed]  object, fd=-1, )> failed with TypeError


@colobas
Copy link

colobas commented Feb 22, 2017

have you had any luck in solving this?

@benad
Copy link

benad commented Feb 23, 2017

You may want to replace gevent-websocket with this fork: https://github.com/karellen/karellen-geventws .

@colobas
Copy link

colobas commented Feb 23, 2017

@benad perfect! thanks a lot!

@vascowhite
Copy link

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

4 participants