为了账号安全,请及时绑定邮箱和手机立即绑定

torado,celery raise is not JSON serializable

torado,celery raise is not JSON serializable

Helenr 2019-04-16 20:27:42
代码就是这里了: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_exceptionraise_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,inwrapperresult=method(self,*args,**kwargs)File"examples/tornado_async.py",line14,ingettasks.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_taskreply_to=reply_toorself.oid,**optionsFile"/usr/local/lib/python2.7/dist-packages/celery-3.1.17-py2.7.egg/celery/app/amqp.py",line305,inpublish_task**kwargsFile"/usr/local/lib/python2.7/dist-packages/kombu-3.0.24-py2.7.egg/kombu/messaging.py",line168,inpublishrouting_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_ensuredreturnfun(*args,**kwargs)File"/usr/local/lib/python2.7/dist-packages/kombu-3.0.24-py2.7.egg/kombu/messaging.py",line184,in_publishmandatory=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_publishmessage,exchange,routing_key,**kwargsFile"/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_putclient.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,indumpsreturnimplementation.dumps(value)File"/usr/local/lib/python2.7/dist-packages/anyjson-0.3.3-py2.7.egg/anyjson/__init__.py",line87,indumpsreturnself._encode(data)File"/usr/lib/python2.7/json/__init__.py",line231,indumpsreturn_default_encoder.encode(obj)File"/usr/lib/python2.7/json/encoder.py",line201,inencodechunks=self.iterencode(o,_one_shot=True)File"/usr/lib/python2.7/json/encoder.py",line264,initerencodereturn_iterencode(o,0)File"/usr/lib/python2.7/json/encoder.py",line178,indefaultraiseTypeError(repr(o)+"isnotJSONserializable")TypeError:isnotJSONserializable
查看完整描述

2 回答

?
摇曳的蔷薇

TA贡献1793条经验 获得超6个赞

你应该设置的参数传递方式是json?
因该是传的参数里面有一些python对象,不能进行json的序列化,要么换一下参数类型,或者把传递方式换成pickle
                            
查看完整回答
反对 回复 2019-04-16
  • 2 回答
  • 0 关注
  • 628 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信