curdir错误(ntpath)python

2024-04-26 11:50:10 发布

您现在位置:Python中文网/ 问答频道 /正文

我一直在使用python的ntpath,curdir特性,但是它不起作用!请注意,如果我有数据文件的直接路径,则不会发生错误。我需要使用项目的相对路径,不能硬编码在项目中我的文件。你知道吗

我的错误是:

Parent suite setup failed:
File not found error :.\DataSetFiles\uOpen Data Extract updated - CID94746.xlsx doesnot exist

在脚本启动时,会发生以下情况:

初始化机器人

*** Settings ***
Resource    ../Generic_Configurations/Import_File.robot

导入_文件.robot

*** Settings ***
Variables    ../Generic_Configurations/ConfigurationsFile.py

配置文件.py

from ntpath import curdir

DataExtractFile = curdir + '\\DataSetFiles\\uOpen Data Extract updated - CID94746.xlsx'
DataSheetFile = curdir + '\\DataSetFiles\\DataSheet.xlsx'

我正在用eclipseide编写robot框架脚本。你知道吗

如有任何意见/建议,敬请垂询!你知道吗


Tags: 文件项目脚本data错误robotextractxlsx