[英]TypeError during send_message in django push notifications 1.2.1, python 3.4, django 1.8.1
During firing off: 开火期间:
GCMDevice.send_message(message)
I get: 我得到:
File "/home/vagrant/.venvs/any_dev/lib/python3.4/site-packages/push_notifications/gcm.py", line 103, in _gcm_send_json
result = json.loads(_gcm_send(data, "application/json"))
File "/usr/local/lib/python3.4/json/__init__.py", line 312, in loads
s.__class__.__name__))
TypeError: the JSON object must be str, not 'bytes'
It's said that lib's python 3.x compatible, but I guess there's problem with encoding. 据说lib与python 3.x兼容,但是我想编码存在问题。 Did anybody experienced something like that? 有人经历过类似的事情吗?
in gcm.py(in my case, located at ~/.virtualenvs/grape/lib/python3.4/site-packages/push_notifications/gcm.py) 在gcm.py中(以我为例,位于〜/ .virtualenvs / grape / lib / python3.4 / site-packages / push_notifications / gcm.py)
replace 更换
result = json.loads(_gcm_send(data, "application/json"))
to 至
result = json.loads(_gcm_send(data, "application/json").decode('utf8'))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.