Python 3.x 从robot框架调用python编码文件时获取FileNotFoundError
我正在尝试编写一个自动化代码,用于根据我传递给环境的值来选择不同的环境值以执行我的测试用例 以下是我尝试的代码:Python 3.x 从robot框架调用python编码文件时获取FileNotFoundError,python-3.x,robotframework,Python 3.x,Robotframework,我正在尝试编写一个自动化代码,用于根据我传递给环境的值来选择不同的环境值以执行我的测试用例 以下是我尝试的代码: # env.robot *** Settings *** Variables setup.py stage01 *** Test Cases *** Print values log to console ${data} 我得到的答复是: [ ERROR ] Error in file 'D:\env.robot': Processing variabl
# env.robot
*** Settings ***
Variables setup.py stage01
*** Test Cases ***
Print values
log to console ${data}
我得到的答复是:
[ ERROR ] Error in file 'D:\env.robot': Processing variable file 'D:\setup2.py' with arguments [ stage01 ]
failed: FileNotFoundError: [Errno 2] No such file or directory: 'values.xlsx'
values.xlsx与.py和.robot文件位于同一目录中
我想根据env变量的值从values.xlsx文件中获取数据,并在robot测试用例中使用这些值
请建议我需要修改的内容或其他方法。您所说的“同一目录”是什么意思?Python在当前工作目录中查找,该目录可能与脚本所在的目录不同。我的意思是,所有三个文件(.xlsx、.py和.robot)都位于同一文件夹中,而不是Python查找相对文件的位置。Python将在当前工作目录中查找。
[ ERROR ] Error in file 'D:\env.robot': Processing variable file 'D:\setup2.py' with arguments [ stage01 ]
failed: FileNotFoundError: [Errno 2] No such file or directory: 'values.xlsx'