mumrah/kafka-python — pull request #204 by mdaniel (2014-08-22 23:12:16+00:00)
Title: Better type errors

In 0.9.2 (and master), if one passes a `group` to `SimpleConsumer` that is a unicode string, it bombs with the terribly unhelpful message below. This PR merely makes the error more helpful by providing a message describing what should have happened and what type was provided. With it in place, the fix would be obvious.
```
Traceback (most recent call last):
File "sniff_topic.py", line 52, in
main(sys.argv)
File "sniff_topic.py", line 38, in main
cons = SimpleConsumer(client, group, topic)
File "/home/ubuntu/venv/local/lib/python2.7/site-packages/kafka/consumer.py", line 243, in __init__
auto_commit_every_t=auto_commit_every_t)
File "/home/ubuntu/venv/local/lib/python2.7/site-packages/kafka/consumer.py", line 115, in __init__
fail_on_error=False)
File "/home/ubuntu/venv/local/lib/python2.7/site-packages/kafka/client.py", line 384, in send_offset_fetch_request
resps = self._send_broker_aware_request(payloads, encoder, decoder)
File "/home/ubuntu/venv/local/lib/python2.7/site-packages/kafka/client.py", line 151, in _send_broker_aware_request
correlation_id=requestId, payloads=payloads)
File "/home/ubuntu/venv/local/lib/python2.7/site-packages/kafka/protocol.py", line 482, in encode_offset_fetch_request
message += write_short_string(group)
File "/home/ubuntu/venv/local/lib/python2.7/site-packages/kafka/util.py", line 23, in write_short_string
return struct.pack('>h%ds' % len(s), len(s), s)
struct.error: argument for 's' must be a string
```

p.s. If you have not yet tried [PyCharm](https://www.jetbrains.com/pycharm/) you don't know what you're missing. I'm surprised that unittest2 allows such things, but the `test.test_util.UtilTest` class redeclared the same method name over and over.