Python(9) Happybase

来源:互联网 发布:dedecms tag 数据库 编辑:程序博客网 时间:2024/05/30 23:09

0. 资料

  • 官网

1. 安装

  • 进入响应环境后,安装happybasethrift
pip install happybasepip install thrift
  • 错误处理:
    • 出现的错误:thriftpy.parser.exc.ThriftParserError: ThriftPy does not support generating module with path in protocol 'd'
    • Windows中才会出现此问题。
    • 参考此文处理
    • 解决方案:修改Lib\site-packages\thriftpy\parser\parser.py文件中的代码:
# 修改前url_scheme = urlparse(path).schemeif 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))# 修改后url_scheme = urlparse(path).schemeif url_scheme == '':    with open(path) as fh:        data = fh.read()elif url_scheme in ('c', 'd','e','f'): # 代表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))
原创粉丝点击