aparo / pyes

Python connector for ElasticSearch - the pythonic way to use ElasticSearch
BSD 3-Clause "New" or "Revised" License
607 stars 270 forks source link

Invalid error message when a non-integer port is given in the connect string #490

Closed ravipra closed 9 years ago

ravipra commented 9 years ago

Invalid error message is given when a non-integer port is given in the connect string.

For example:

conn_str = 'localhost' + ':' + str('abcd') es = ES(conn_str)

It throws: Traceback (most recent call last): File "test.py", line 4, in es = ES(conn_str) File "/usr/local/lib/python2.7/dist-packages/pyes/es.py", line 274, in init self._check_servers() File "/usr/local/lib/python2.7/dist-packages/pyes/es.py", line 330, in _check_servers raise RuntimeError("Invalid port: \"%s\"" % port) UnboundLocalError: local variable 'port' referenced before assignment

ravipra commented 9 years ago

Fixed by issue 491.