0

I updated to kafka-python, now I get the following error:

Traceback (most recent call last):
  File "app.py", line 2, in <module>
    from kafka import KafkaConsumer
ImportError: cannot import name 'KafkaConsumer' from 'kafka' (unknown location)

Previously, when I got the following error, it might have been due to outdated kafka module.

Traceback (most recent call last):
  File "app.py", line 2, in <module>
    from kafka import KafkaConsumer
  File "/home/vijay/lehra/.venv/lib/python3.8/site-packages/kafka/__init__.py", line 23, in <module>
    from kafka.producer import KafkaProducer
  File "/home/vijay/lehra/.venv/lib/python3.8/site-packages/kafka/producer/__init__.py", line 4, in <module>
    from .simple import SimpleProducer
  File "/home/vijay/lehra/.venv/lib/python3.8/site-packages/kafka/producer/simple.py", line 54
    return '<SimpleProducer batch=%s>' % self.async
                                              ^
SyntaxError: invalid syntax
OneCricketeer
  • 179,855
  • 19
  • 132
  • 245

0 Answers0