1、message=("Could not start SASL: %s" % self.sasl.getError()))
thrift.transport.TTransport.TTransportException: Could not start SASL: b'Error in sasl_client_start (-12) SASL library is not initialized
解决方法:https://blog.csdn.net/wenjun_xiao/article/details/104458940
先直接贴出解决方案,后面再给出分析过程。在Windows中使用管理员权限打开控制台,在控制执行一段命令即可,操作如下。
C:\Windows\system32> FOR /F "usebackq delims=" %A IN (`python -c "from importlib import util;import os;print(os.path.join(os.path.dirname(util.find_spec('sasl').origin),'sasl2'))"`) DO (
REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Carnegie Mellon\Project Cyrus\SASL Library" /v SearchPath /t REG_SZ /d "%A"
)
2、AttributeError: 'TSaslClientTransport' object has no attribute 'readAll'
解决方法:https://www.codeleading.com/article/5868456886/
pip install thrift_sasl==0.3.0
更新依赖thrift_sasl包到0.3.0就可以了
------------------------------------------------------------------------------------
>>> from pyhive import hive
>>> conn = hive.Connection(host='172.100.0.11',port=10000)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "...\Python37\lib\site-packages\pyhive\hive.py", line 192, in __init__
self._transport.open()
File "...\Python37\lib\site-packages\thrift_sasl\__init__.py", line 79, in open
message=("Could not start SASL: %s" % self.sasl.getError()))
thrift.transport.TTransport.TTransportException: Could not start SASL: b'Error in sasl_client_start (-12) SASL library is not initialized
解决方法:先直接贴出解决方案,后面再给出分析过程。在Windows中使用管理员权限打开控制台,在控制执行一段命令即可,操作如下
C:\Windows\system32> FOR /F "usebackq delims=" %A IN (`python -c "from importlib import util;import os;print(os.path.join(os.path.dirname(util.find_spec('sasl').origin),'sasl2'))"`) DO (
REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Carnegie Mellon\Project Cyrus\SASL Library" /v SearchPath /t REG_SZ /d "%A"
)
参考:https://blog.csdn.net/wenjun_xiao/article/details/104458940