impyla: TypeError: can't concat bytes to str (Python 3.5, thrift-sasl with pure-sasl)
Due to issue #237 , I removed sasl 0.2.1 and replaced it with pure-sasl 0.3.0 based on this commit by @nonsleepr : https://github.com/cloudera/impyla/commit/5e386d6495b580ae88efd81dd0f8927af5157bb8
but then I got below error:
>>> conn = connect(host='<host>', port=21050, database='<db>', auth_mechanism='PLAIN', user='<user>', password='<pass>')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/tmp/python/miniconda3/lib/python3.5/site-packages/impala/dbapi.py", line 147, in connect
auth_mechanism=auth_mechanism)
File "/tmp/python/miniconda3/lib/python3.5/site-packages/impala/hiveserver2.py", line 758, in connect
transport.open()
File "/tmp/python/miniconda3/lib/python3.5/site-packages/thrift_sasl-0.2.1-py3.5.egg/thrift_sasl/__init__.py", line 75, in open
File "/tmp/python/miniconda3/lib/python3.5/site-packages/thrift_sasl-0.2.1-py3.5.egg/thrift_sasl/__init__.py", line 94, in _send_message
TypeError: can't concat bytes to str
I am using:
- CDH 5.8 / 5.9
- Anaconda Python 3.5
- impyla 0.14.0
- bitarray 0.8.1
- thriftpy 0.3.9
- six 1.10.0
- thrift-sasl 0.2.1 (installed via pip with ‘–no-deps’ option)
- pure-sasl 0.3.0
About this issue
- Original URL
- State: open
- Created 7 years ago
- Comments: 17 (3 by maintainers)
Commits related to this issue
- fix https://github.com/cloudera/impyla/issues/238 — committed to snowch/thrift_sasl by snowch 7 years ago
By changing line 94 in
thrift_sasl/__init__.pytoThe output shows that on the first time
_send_messageis calledbodyis passed as str. The second time it is passed correctly as bytesHere’s a fix for the problem After installing:
Go to directory
<site-packages path>\thrift_saslRemove__pycache__if exists Append below codes before line 94self._trans.write(header + body)in__init__.py:it works for me