猿问

torado,celery raise is not JSON serializable

代码就是这里了:https://github.com/mher/tornado-celery/
报错:
Traceback(mostrecentcalllast):
File"/usr/local/lib/python2.7/dist-packages/tornado-4.0.2-py2.7-linux-x86_64.egg/tornado/web.py",line1288,in_stack_context_handle_exception
raise_exc_info((type,value,traceback))
File"/usr/local/lib/python2.7/dist-packages/tornado-4.0.2-py2.7-linux-x86_64.egg/tornado/web.py",line1475,inwrapper
result=method(self,*args,**kwargs)
File"examples/tornado_async.py",line14,inget
tasks.sleep.apply_async(args=[3],callback=self.on_result)
File"/usr/local/lib/python2.7/dist-packages/celery-3.1.17-py2.7.egg/celery/app/task.py",line555,inapply_async
**dict(self._get_exec_options(),**options)
File"/usr/local/lib/python2.7/dist-packages/celery-3.1.17-py2.7.egg/celery/app/base.py",line353,insend_task
reply_to=reply_toorself.oid,**options
File"/usr/local/lib/python2.7/dist-packages/celery-3.1.17-py2.7.egg/celery/app/amqp.py",line305,inpublish_task
**kwargs
File"/usr/local/lib/python2.7/dist-packages/kombu-3.0.24-py2.7.egg/kombu/messaging.py",line168,inpublish
routing_key,mandatory,immediate,exchange,declare)
File"/usr/local/lib/python2.7/dist-packages/kombu-3.0.24-py2.7.egg/kombu/connection.py",line436,in_ensured
returnfun(*args,**kwargs)
File"/usr/local/lib/python2.7/dist-packages/kombu-3.0.24-py2.7.egg/kombu/messaging.py",line184,in_publish
mandatory=mandatory,immediate=immediate,
File"/usr/local/lib/python2.7/dist-packages/kombu-3.0.24-py2.7.egg/kombu/transport/virtual/__init__.py",line521,inbasic_publish
message,exchange,routing_key,**kwargs
File"/usr/local/lib/python2.7/dist-packages/kombu-3.0.24-py2.7.egg/kombu/transport/virtual/exchange.py",line61,indeliver
_put(queue,message,**kwargs)
File"/usr/local/lib/python2.7/dist-packages/kombu-3.0.24-py2.7.egg/kombu/transport/redis.py",line673,in_put
client.lpush(self._q_for_pri(queue,pri),dumps(message))
File"/usr/local/lib/python2.7/dist-packages/anyjson-0.3.3-py2.7.egg/anyjson/__init__.py",line141,indumps
returnimplementation.dumps(value)
File"/usr/local/lib/python2.7/dist-packages/anyjson-0.3.3-py2.7.egg/anyjson/__init__.py",line87,indumps
returnself._encode(data)
File"/usr/lib/python2.7/json/__init__.py",line231,indumps
return_default_encoder.encode(obj)
File"/usr/lib/python2.7/json/encoder.py",line201,inencode
chunks=self.iterencode(o,_one_shot=True)
File"/usr/lib/python2.7/json/encoder.py",line264,initerencode
return_iterencode(o,0)
File"/usr/lib/python2.7/json/encoder.py",line178,indefault
raiseTypeError(repr(o)+"isnotJSONserializable")
TypeError:isnotJSONserializable
Helenr
浏览 629回答 2
2回答

摇曳的蔷薇

你应该设置的参数传递方式是json?因该是传的参数里面有一些python对象,不能进行json的序列化,要么换一下参数类型,或者把传递方式换成pickle
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答