使用python连接hive,在
from impala.dbapi import connect 语句报如下错误:
ThriftParserError: ThriftPy does not support generating module with path in protocol 'd'
定位到 D:\Anaconda3\Lib\site-packages\thriftpy\parser\parser.py的
if url_scheme == '':
with open(path) as fh:
data = fh.read()
elif url_scheme in ('http', 'https'):
data = urlopen(path).read()
else:
raise ThriftParserError('ThriftPy does not support generating module '
'with path in protocol \'{}\''.format(
url_scheme))
更改为
if url_scheme == '':
with open(path) as fh:
data = fh.read()
elif url_scheme in ('c', 'd','e','f''):
with open(path) as fh:
data = fh.read()
elif url_scheme in ('http', 'https'):
data = urlopen(path).read()
else:
raise ThriftParserError('ThriftPy does not support generating module '
'with path in protocol \'{}\''.format(
url_scheme))
命令行使用python -m py_comile parser.py 进行编译,即可