From ef214ccce7d90e682706b2dd66d4a169456283a7 Mon Sep 17 00:00:00 2001 From: paramiao Date: Fri, 4 Jul 2014 11:22:31 +0800 Subject: [PATCH] fix topic unicode error --- kafka/producer.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kafka/producer.py b/kafka/producer.py index 8e40be5b1..9a7d51626 100644 --- a/kafka/producer.py +++ b/kafka/producer.py @@ -227,6 +227,9 @@ def _next_partition(self, topic): return self.partition_cycles[topic].next() def send_messages(self, topic, *msg): + if type(topic) == unicode: + log.exception("topic must be encode to str, not unicode") + raise partition = self._next_partition(topic) return super(SimpleProducer, self).send_messages(topic, partition, *msg)