目前支持python3.7的excellibrary未更新,一直沿用的事python2.X对应的版本,由于语法上的一些不同,也导致了直接通过pip安装会报错,
当提示如图所示错误时:execfile(join(dirname(file), ‘ExcelLibrary’, ‘version.py’)) NameError: name ‘execfile’ is not defined
可以通过修改文件,使excellibrary适用与3.X版本。
首先通过该网址https://pypi.org/project/robotframework-excellibrary/#files 先下载excellibrary,然后修改以下几个文件
1.\robotframework-excellibrary-0.0.2\setup.py
#execfile(join(dirname(file), ‘ExcelLibrary’, ‘version.py’))
exec(open(join(dirname(file), ‘ExcelLibrary’, ‘version.py’)).read())
2.\robotframework-excellibrary-0.0.2\ExcelLibrary\ExcelLibrary.py
将所有的print xxx 语句修改为 print(xxx)
- \robotframework-excellibrary-0.0.2\ExcelLibrary\__init__.py
#from ExcelLibrary import ExcelLibrary
#from version import VERSION
from .ExcelLibrary import ExcelLibrary
from .version import VERSION
4.\robotframework-excellibrary-0.0.2\ExcelLibrary\ExcelLibrary.py
#from version import VERSION
from .version import VERSION
文件修改完毕后,通过python setup.py install 安装