Skip to content
This repository has been archived by the owner on Apr 29, 2022. It is now read-only.

Getting TypeError in the log on each request #39

Open
apirogov opened this issue Aug 8, 2016 · 8 comments
Open

Getting TypeError in the log on each request #39

apirogov opened this issue Aug 8, 2016 · 8 comments

Comments

@apirogov
Copy link

apirogov commented Aug 8, 2016

Even when just trying the first example ("simple usage"), I get the following exception on each request:

Traceback (most recent call last):
  File "/usr/lib/python3.5/site-packages/gevent/greenlet.py", line 534, in run
    result = self._run(*self.args, **self.kwargs)
  File "/usr/lib/python3.5/site-packages/gevent/baseserver.py", line 25, in _handle_and_close_when_done
    return handle(*args_tuple)
  File "/usr/lib/python3.5/site-packages/gevent/pywsgi.py", line 1253, in handle
    handler.handle()
  File "/usr/lib/python3.5/site-packages/gevent/pywsgi.py", line 443, in handle
    result = self.handle_one_request()
  File "/usr/lib/python3.5/site-packages/gevent/pywsgi.py", line 658, in handle_one_request
    self.handle_one_response()
  File "/usr/lib/python3.5/site-packages/gevent/pywsgi.py", line 916, in handle_one_response
    self.log_request()
  File "/home/admin/.local/lib/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 0x7fda8555e048: _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

the strange thing is, the http requests work fine. I did not try the websocket route yet, as I first wanted to know if I'm doing something wrong or is this a bug?

@ChillingVan
Copy link

I also have same error. Is this because of we using python3?

@benma
Copy link

benma commented Sep 15, 2016

I also have this error, I am also using python3.

@o3bvv
Copy link
Contributor

o3bvv commented Sep 27, 2016

I also confirm this with Python 3. Runs good with Python 2. I'll take a look.

Traceback (most recent call last):
  File "/home/alex/.virtualenvs/services/lib/python3.4/site-packages/gevent/greenlet.py", line 534, in run
    result = self._run(*self.args, **self.kwargs)
  File "/home/alex/.virtualenvs/services/lib/python3.4/site-packages/gevent/baseserver.py", line 25, in _handle_and_close_when_done
    return handle(*args_tuple)
  File "/home/alex/.virtualenvs/services/lib/python3.4/site-packages/gevent/pywsgi.py", line 1253, in handle
    handler.handle()
  File "/home/alex/.virtualenvs/services/lib/python3.4/site-packages/gevent/pywsgi.py", line 443, in handle
    result = self.handle_one_request()
  File "/home/alex/.virtualenvs/services/lib/python3.4/site-packages/gevent/pywsgi.py", line 658, in handle_one_request
    self.handle_one_response()
  File "/home/alex/.virtualenvs/services/lib/python3.4/site-packages/gevent/pywsgi.py", line 916, in handle_one_response
    self.log_request()
  File "/home/alex/.virtualenvs/services/lib/python3.4/site-packages/geventwebsocket/handler.py", line 236, in log_request
    if '101' not in self.status:
TypeError: 'str' does not support the buffer interface
<Greenlet at 0x7efcaa0fa2a8: _handle_and_close_when_done(<bound method WSGIServer.handle of <WSGIServer at , <bound method WSGIServer.do_close of <WSGIServer a, (<gevent._socket3.socket [closed]  object, fd=-1, )> failed with TypeError

@Xoerk
Copy link

Xoerk commented Mar 9, 2017

Any update? I'm getting it on python3 also.

@arruda
Copy link

arruda commented Mar 10, 2017

@cemozerr
Copy link

cemozerr commented Jan 2, 2018

I too have the same issue with TypeError on python 3.

@Alex-CodeLab
Copy link

the example seems to be incorrect, should be

       something = {'data':'test'}
       ws.send(message=json.dumps(something))

@BenePronomen
Copy link

Still having this issue. It's 2020 and it breaks in python 3 -_-

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

No branches or pull requests

9 participants