我在 Gearman 中遇到了错误。尝试类似 ,只发送字符串字母或数字或字符串编号,但总是收到此错误,请帮助...(相同的代码工作其他视图(
Request Method: POST
Request URL: http://local.example.com:8000/business/user-panel
Django Version: 1.6.6
Exception Type: ProtocolError
Exception Value:
Received non-binary arguments: {'unique': 'ab69c55005d118f92e27dcaa3a9bb5d7', 'task': u'task_name', 'data': "1010"}
Exception Location: /home/xcoder/NopyFlexiEnv/lib/python2.7/site-packages/gearman/protocol.py in pack_binary_command, line 242
Python Executable: /home/xcoder/NopyFlexiEnv/bin/python2.7
Python Version: 2.7.6
看完源码后,发现 gearman 客户端不支持 unicode
。
将参数的类型更改为str
或bytes
将解决您的问题。
client.submit_job("task1") # error: Received non-binary arguments
client.submit_job(b"task1") # ok