当前位置: 首页 > 工具软件 > ThriftPy > 使用案例 >

ThriftParserError: ThriftPy does not support generating module with path in protocol 'd'

戚浩淼
2023-12-01

使用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 进行编译,即可

 类似资料:

相关阅读

相关文章

相关问答