Error 'too many values to unpack' in KafkaAdminClient: _send_request_to_controller
See original GitHub issueDear kafka-python team,
We start using the API KafkaAdminClient (1.4.4) to create a Topic on a kafka version 1.1 (0.11.0 protocol). We use the following code:
kac_dst = KafkaAdminClient(bootstrap_servers=bootstrap_servers,client_id='data')
logger.info("Creating topic {}".format(topic_name))
topic_list = []
topic = NewTopic(name=topic_name, num_partitions=2, replication_factor=3)
topic_list.append(topic)
response = kac_dst.create_topics(new_topics=topic_list, validate_only=True)
The following error occur while executing create_topics function:
kafka/admin/client.py", line 398, in create_topics
return self._send_request_to_controller(request)
kafka/admin/client.py", line 335, in _send_request_to_controller
for topic, error_code in getattr(response, "topic_errors", response.topic_error_codes):
ValueError: too many values to unpack (expected 2)
If we set validate_only=False, using one element or few,the same error occur, but the topic/s are created .
Regards, Pablo.
Issue Analytics
- State:
- Created 5 years ago
- Comments:13 (1 by maintainers)
This fix was released in
1.4.5
, so it should be available in1.4.6
… additionally, the only commit to https://github.com/dpkp/kafka-python/commits/master/kafka/admin/client.py since1.4.6
was released would not affect this.Are you positive you tested this correctly? You should start with a fresh virtualenv to doublecheck…
Confirming that installing from
master
works, thanks for the tip! For anyone interested:pip install git+git://github.com/dpkp/kafka-python.git
(Using kafka-python 1.4.6 didn’t work for me though, I’m surprised this fix didn’t make it into the release)
EDIT: Made a mistake while testing, it does work when using 1.4.6 😃