0

I am trying to produce AVRO data to Kafka topic through python producer script, I already installed python dependencies avro-python3 and confluent_kafka, however when running this script i got below error:


  File "./kafka_producer_avro.py", line 24, in <module>
    kafka_producer_obj = Producer(kafka_config_obj)
cimpl.KafkaException: KafkaError{code=_INVALID_ARG,val=-186,str="No such configuration property: "bootstrap_servers""}

After investigation i found that I should install (libsasl2-dev and libsasl2-modules) dependencies. (sudo yum install gcc libffi-devel python-devel python-pip python-wheel openssl-devel libsasl2-devel openldap-devel), but i got below Error: Unable to find a match: python-devel python-pip python-wheel libsasl2-devel

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245

1 Answers1

0

Your shown error has nothing to do with OS packages.

It's bootstrap.servers, not with an underscore. Also, the Kafka module is with hyphen, not underscore.

Docs - https://docs.confluent.io/kafka-clients/python/current/overview.html

You can additionally install fastavro with pip.

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
  • Thanks OneCricketeer, it works after modifying kafka object from kafka_config_obj = {'bootstrap_servers': KAFKA_BOOTSTRAP_SERVERS_CONS} to kafka_config_obj = {'bootstrap.servers': KAFKA_BOOTSTRAP_SERVERS_CONS} and i didn't need to install the fastavro package :) – Amira Hussein Dec 01 '22 at 08:42
  • My point with fastavro is that it'll run quicker if you're serializing many records, not to fix the error you're getting – OneCricketeer Dec 01 '22 at 14:09
  • Okay Great, i will try again to install it as I faced an error while trying the last time. Thanks again :) – Amira Hussein Dec 04 '22 at 08:38