frontera icon indicating copy to clipboard operation
frontera copied to clipboard

exceptions.AttributeError: 'NoneType' object has no attribute 'encode'

Open cduongvn opened this issue 9 years ago • 3 comments

BACKEND = 'frontera.contrib.backends.hbase.HBaseBackend' MESSAGE_BUS = 'frontera.contrib.messagebus.kafkabus.MessageBus'

It seems that there is a bug when not specifying SCORING_TOPIC

Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/frontera/worker/strategy.py", line 260, in worker.run() File "/usr/local/lib/python2.7/dist-packages/frontera/worker/strategy.py", line 191, in run self.task.start(interval=0) File "/usr/local/lib/python2.7/dist-packages/twisted/internet/task.py", line 194, in start self() File "/usr/local/lib/python2.7/dist-packages/twisted/internet/task.py", line 239, in call d = defer.maybeDeferred(self.f, _self.a, *_self.kw) --- --- File "/usr/local/lib/python2.7/dist-packages/twisted/internet/defer.py", line 150, in maybeDeferred result = f(_args, *_kw) File "/usr/local/lib/python2.7/dist-packages/frontera/worker/strategy.py", line 175, in work self.update_score.flush() File "/usr/local/lib/python2.7/dist-packages/frontera/worker/strategy.py", line 41, in flush self._producer.send(None, *self._buffer) File "/usr/local/lib/python2.7/dist-packages/frontera/contrib/messagebus/kafkabus.py", line 81, in send self._producer.send_messages(self._topic, *messages) File "/usr/local/lib/python2.7/dist-packages/kafka/producer/simple.py", line 50, in send_messages topic = topic.encode('utf-8') exceptions.AttributeError: 'NoneType' object has no attribute 'encode'

cduongvn avatar Jun 19 '16 09:06 cduongvn

Hi Canh,

It's not a bug, HBaseBackend implies distributed backend and spiders run mode, therefore it requires strategy worker and scoring log set up.

Отправлено с iPhone

19 июня 2016 г., в 11:57, Canh Duong [email protected] написал(а):

BACKEND = 'frontera.contrib.backends.hbase.HBaseBackend' MESSAGE_BUS = 'frontera.contrib.messagebus.kafkabus.MessageBus'

It seems that there is a bug when not specifying SCORING_TOPIC

Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/frontera/worker/strategy.py", line 260, in worker.run() File "/usr/local/lib/python2.7/dist-packages/frontera/worker/strategy.py", line 191, in run self.task.start(interval=0) File "/usr/local/lib/python2.7/dist-packages/twisted/internet/task.py", line 194, in start self() File "/usr/local/lib/python2.7/dist-packages/twisted/internet/task.py", line 239, in call d = defer.maybeDeferred(self.f, self.a, *self.kw)


File "/usr/local/lib/python2.7/dist-packages/twisted/internet/defer.py", line 150, in maybeDeferred result = f(args, *kw) File "/usr/local/lib/python2.7/dist-packages/frontera/worker/strategy.py", line 175, in work self.update_score.flush() File "/usr/local/lib/python2.7/dist-packages/frontera/worker/strategy.py", line 41, in flush self._producer.send(None, *self._buffer) File "/usr/local/lib/python2.7/dist-packages/frontera/contrib/messagebus/kafkabus.py", line 81, in send self._producer.send_messages(self._topic, *messages) File "/usr/local/lib/python2.7/dist-packages/kafka/producer/simple.py", line 50, in send_messages topic = topic.encode('utf-8') exceptions.AttributeError: 'NoneType' object has no attribute 'encode'

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

sibiryakov avatar Jun 19 '16 11:06 sibiryakov

Is there any reason to not have a default value for SCORING_TOPIC?

cduongvn avatar Jun 19 '16 14:06 cduongvn

@nautilus28 this is going to be added with upcoming kafka-python 1.x.x support release.

sibiryakov avatar Jun 20 '16 07:06 sibiryakov