TypeError: can't concat bytes to str (Python 3.5, thrift-sasl with pure-sasl)
See original GitHub issueDue 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
Issue Analytics
- State:
- Created 7 years ago
- Comments:17 (3 by maintainers)
Top Results From Across the Web
TypeError: can't concat str to bytes in Python
The Python "TypeError: can't concat str to bytes" occurs when we try to concatenate a bytes object and a string. To solve the...
Read more >python - Can't concat bytes to str
subprocess.check_output() returns a bytestring. In Python 3, there's no implicit conversion between unicode ( str ) objects and bytes objects.
Read more >Making Impala connection from Python on Windows ...
Install Microsoft Visual C++ Compiler for Python 2.7 (see ... impyla thrift_sasl pure-sasl ... TypeError: can't concat bytes to str
Read more >python3.5连接hive(impala)_我心依依旧的博客
环境python 3.5win 7一、按照以下顺序安装所需的包及版本:pip ... pip install pure-sasl ... 报如下错误TypeError: can't concat str to bytes.
Read more >TypeError: can't concat bytes to str (Python 3.5, thrift-sasl with pure ...
Due to issue #237 ,I removed sasl 0.2.1 and replaced it with pure-sasl 0.3.0based on this commit by @nonsleepr : https.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
By changing line 94 in
thrift_sasl/__init__.py
toThe output shows that on the first time
_send_message
is calledbody
is 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_sasl
Remove__pycache__
if exists Append below codes before line 94self._trans.write(header + body)
in__init__.py
:it works for me