TypeError: __init__() takes exactly 1 argument (2 given)
<p>I'm trying to run the monasca-persister component in ubuntu, but there is an error with a file related with kafka, my kafka server is running well.</p>

<pre><code>Process Process-2:
commit_timeout=kafka_conf.max_wait_time_seconds)
File "/usr/local/lib/python2.7/dist-packages/monasca_common/kafka/consumer.py", line 92, in __init__
Traceback (most recent call last):
self._kafka = kafka.client.KafkaClient(kafka_url)
TypeError: __init__() takes exactly 1 argument (2 given)
File "/usr/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
self.run()
File "/usr/lib/python2.7/multiprocessing/process.py", line 114, in run
self._target(*self._args, **self._kwargs)
File "persister.py", line 126, in start_process
persister = Persister(kafka_config, cfg.CONF.zookeeper, respository)
File "/home/dpeuser/monasca-persister/monasca_persister/repositories/persister.py", line 42, in __init__
commit_timeout=kafka_conf.max_wait_time_seconds)
File "/usr/local/lib/python2.7/dist-packages/monasca_common/kafka/consumer.py", line 92, in __init__
self._kafka = kafka.client.KafkaClient(kafka_url)
TypeError: __init__() takes exactly 1 argument (2 given)
2016-08-31 12:05:55.245 28419 INFO __main__ [-] Received signal 17, beginning graceful shutdown.
</code></pre>

<p>So, I check the file of the error but I can't figure out what is wrong </p>

<pre><code>class KafkaConsumer(object):
def __init__(self, kafka_url,
             zookeeper_url, zookeeper_path,
             group, topic,
             fetch_size=1048576,
             repartition_callback=None,
             commit_callback=None,
             commit_timeout=30):
    """Init
         kafka_url            - Kafka location
         zookeeper_url        - Zookeeper location
         zookeeper_path       - Zookeeper path used for partition
                                negotiation
         group                - Kafka consumer group
         topic                - Kafka topic
         repartition_callback - Callback to run when the Kafka consumer
                                group changes.  Repartitioning takes a
                                relatively long time so this is a good
                                time to flush and commit any data.
         commit_callback      - Callback to run when the commit_timeout
                                has elapsed between commits.
         commit_timeout       - Timeout between commits.
    """

    self._kazoo_client = None
    self._set_partitioner = None

    self._repartition_callback = repartition_callback

    self._commit_callback = commit_callback
    self._commit_timeout = commit_timeout

    self._last_commit = 0

    self._partitions = []

    self._kafka_group = group
    self._kafka_topic = topic
    self._kafka_fetch_size = fetch_size

    self._zookeeper_url = zookeeper_url
    self._zookeeper_path = zookeeper_path

    self._kafka = kafka.client.KafkaClient(kafka_url)

    self._consumer = self._create_kafka_consumer()
</code></pre>

<p>The <code>KafkaClient</code> class doesn't take any positional arguments. Pass in configuration as <em>keyword arguments</em>:</p>

<pre><code>self._kafka = kafka.client.KafkaClient(bootstrap_servers=kafka_url)
</code></pre>

<p>See the <a href="http://kafka-python.readthedocs.io/en/master/_modules/kafka/client_async.html#KafkaClient" rel="nofollow">source linked from the documentation</a> to see what configuration keywords are accepted and what their default values are. Many of the same configuration options are also documented for the <a href="http://kafka-python.readthedocs.io/en/master/apidoc/KafkaConsumer.html" rel="nofollow"><code>KafkaConsumer</code> class</a>.</p>

python ubuntu apache-kafka