报错信息
File "D:\Y_Script\OTATool_1_1_9\commonFiles\readExcelFile.py", line 7, in __init__
self.xl = xlrd.open_workbook('{}'.format(filename))
File "D:\G_Working\Z_Z_python_environment\environment\OTATool_AbouTabletTool\venv\lib\site-packages\xlrd\__init__.py", line 170, in open_workbook
raise XLRDError(FILE_FORMAT_DESCRIPTIONS[file_format]+'; not supported')
xlrd.biffh.XLRDError: Excel xlsx file; not supported
python安装最新版本的xlrd不支持读取.xlsx的excel文件
需要回退到xlrd1.2.0版本
#卸载已安装的
pip uninstall xlrd
#下载对应的版本
pip install xlrd==1.2.0
C:\Users\Lvan8>pip uninstall xlrd
Found existing installation: xlrd 2.0.1
Uninstalling xlrd-2.0.1:
Would remove:
d:\g_working\z_z_python_environment\environment\otatool_aboutablettool\venv\lib\site-packages\xlrd-2.0.1.dist-info\*
d:\g_working\z_z_python_environment\environment\otatool_aboutablettool\venv\lib\site-packages\xlrd\*
d:\g_working\z_z_python_environment\environment\otatool_aboutablettool\venv\scripts\runxlrd.py
Proceed (y/n)? y
Successfully uninstalled xlrd-2.0.1
C:\Users\Lvan8>pip install xlrd==1.2.0
Collecting xlrd==1.2.0
Using cached xlrd-1.2.0-py2.py3-none-any.whl (103 kB)
Installing collected packages: xlrd
Successfully installed xlrd-1.2.0
回退完成后正常运行。
感谢此博客提供参考
https://blog.csdn.net/zhaoleiedu/article/details/111472654
欢迎关注我的微信公众号:
梦无矶的测试开发之路