django-ddp icon indicating copy to clipboard operation
django-ddp copied to clipboard

Python3 compatibility error

Open moaxey opened this issue 8 years ago • 3 comments

I don't know how to fix this in a python2 and python3 compatible way sorry. Your pypy entry does suggest python3 is supported https://pypi.python.org/pypi/django-ddp/0.19.1

I had to make this change for python3.5

--- a/dddp/views.py +++ b/dddp/views.py @@ -26,7 +26,7 @@ def dict_merge(lft, rgt): if not isinstance(rgt, dict): return rgt result = deepcopy(lft)

  • for key, val in rgt.iteritems():
  • for key, val in rgt.items(): if key in result and isinstance(result[key], dict): result[key] = dict_merge(result[key], val) else:

moaxey avatar Mar 18 '16 10:03 moaxey

I am also getting following error in python 3.5 Traceback (most recent call last): File "/var/www/html/py35_ev/lib/python3.5/site-packages/gevent/pywsgi.py", line 936, in handle_one_response self.run_application() File "/var/www/html/py35_ev/lib/python3.5/site-packages/geventwebsocket/handler.py", line 88, in run_application return super(WebSocketHandler, self).run_application() File "/var/www/html/py35_ev/lib/python3.5/site-packages/gevent/pywsgi.py", line 910, in run_application self.process_result() File "/var/www/html/py35_ev/lib/python3.5/site-packages/gevent/pywsgi.py", line 896, in process_result self.write(data) File "/var/www/html/py35_ev/lib/python3.5/site-packages/gevent/pywsgi.py", line 742, in write self._write_with_headers(data) File "/var/www/html/py35_ev/lib/python3.5/site-packages/gevent/pywsgi.py", line 764, in _write_with_headers self._write(data) File "/var/www/html/py35_ev/lib/python3.5/site-packages/gevent/pywsgi.py", line 724, in _write self._sendall(data) File "/var/www/html/py35_ev/lib/python3.5/site-packages/gevent/pywsgi.py", line 702, in _sendall self.socket.sendall(data) File "/var/www/html/py35_ev/lib/python3.5/site-packages/gevent/_socket3.py", line 408, in sendall data_memory = _get_memory(data) File "/var/www/html/py35_ev/lib/python3.5/site-packages/gevent/_socket3.py", line 35, in _get_memory mv = memoryview(data) TypeError: memoryview: a bytes-like object is required, not 'str' Thu Nov 3 11:47:04 2016 {'REMOTE_ADDR': '127.0.0.1', 'REMOTE_PORT': '56104', 'HTTP_HOST': '127.0.0.1:8000', (hidden keys: 23)} failed with TypeError

sudipta26889 avatar Nov 03 '16 11:11 sudipta26889

@moaxey Did you want to submit a pull request with your changes from .iteritems() to .items()?

tysonclugg avatar Nov 06 '16 22:11 tysonclugg

Sorry I was just experimenting, moved on to django channels and I've lost the checkout I did that with, so best I have is as above.

moaxey avatar Dec 10 '16 01:12 moaxey