• python接口测试,第三方包xlrd和xlutils,怎么安装


    第1个:xlrd的下载地址:https://pypi.python.org/pypi/xlrd/0.9.2

    安装过程:下载后解压文件夹,使用cd命令行进入该文件夹后,用命令:python setup.py install 之后再import发现安装好了

    第2个:pip install xlutils 安装xlutils,就可以了

    第3个:pip install jsonpath_rw,安装jsonpath_rw,就可以了

    问题反馈:

    报错:

    File "/Volumes/MacHD/work/stock/main.py", line 20, in main
        xls= xlrd.open_workbook('Important_declaredate.xls',encoding_override='utf-8')
      File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/xlrd/__init__.py", line 435, in open_workbook
        ragged_rows=ragged_rows,
      File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/xlrd/book.py", line 91, in open_workbook_xls
        biff_version = bk.getbof(XL_WORKBOOK_GLOBALS)
      File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/xlrd/book.py", line 1258, in getbof
        bof_error('Expected BOF record; found %r' % self.mem[savpos:savpos+8])
      File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/xlrd/book.py", line 1252, in bof_error
        raise XLRDError('Unsupported format, or corrupt file: ' + msg)
    xlrd.biffh.XLRDError: Unsupported format, or corrupt file: Expected BOF record; found 'xd6xb8xb1xea\xc8xd5xc6'

     解决方法:

    查看一下对应的xls是否损坏,或者是否为xls文件,有可能只是后缀名为表格,内容实际上为json。我吧xls文件删除,重新建了一个xlsx文件,就好了。

  • 相关阅读:
    TOJ 假题之 Cow Brainiacs
    TOJ 2596: Music Notes
    Wannafly模拟赛2
    2017 ACM-ICPC 亚洲区(乌鲁木齐赛区)网络赛
    2017 ACM/ICPC Asia Regional Shenyang Online
    北京师范大学第十五届ACM决赛-重现赛
    Codeforces Round #433 (Div. 2, based on Olympiad of Metropolises)
    Codeforces Round #432 (Div. 2, based on IndiaHacks Final Round 2017)
    LibreOJ β Round #4
    长沙理工大学第十二届ACM大赛-重现赛
  • 原文地址:https://www.cnblogs.com/qiaoxin/p/8962301.html
Copyright © 2020-2023  润新知