I installed the kafka-python package for Python. I have a kafka producer and consumer ruing. I want the python code to read the kafka topic and print out the messages.
My python code is below:
import sys from kafka import KafkaConsumer
def kafkatest(): print "Step 1 complete" consumer=KafkaConsumer('test',bootstrap_servers=['localhost:9092']) for message in consumer: print "Next message" print message
if name=="main": kafkatest()
I get the following error:
C:Python27>python.exe kafka.py Traceback (most recent call last): File "kafka.py", line 2, in from kafka import KafkaConsumer File "C:Python27kafka.py", line 2, in from kafka import KafkaConsumer ImportError: caot import name KafkaConsumer
Any suggestions on what I am missing here?
