假设我有一个文件RegressionSystem.exe.我想用-config参数执行这个可执行文件.命令行应该像:
RegressionSystem.exe -config filename
Run Code Online (Sandbox Code Playgroud)
我尝试过:
regression_exe_path = os.path.join(get_path_for_regression,'Debug','RegressionSystem.exe')
config = os.path.join(get_path_for_regression,'config.ini')
subprocess.Popen(args=[regression_exe_path,'-config', config])
Run Code Online (Sandbox Code Playgroud)
但它不起作用.
我有一个cfg文件.在该cfg文件中有一行如下:
[Environment]
automation_type=GFX ;available options: GEM, HEXAII
Run Code Online (Sandbox Code Playgroud)
我想通过以下方式修改此行:
[Environment]
automation_type=ABC ;available options: GEM, HEXAII
Run Code Online (Sandbox Code Playgroud)
我为此编写了以下代码:
get_path_for_od_cfg = r"C:\Users\marahama\Desktop\Abdur\abc_MainReleaseFolder\OD\od\odConfig.cfg"
config = ConfigParser.RawConfigParser()
config.read(get_path_for_OpenDebug_cfg)
for sec in config.sections():
for attr in config.options(sec):
if sec =='Environment' and attr == 'automation_type':
config.set('Environment','automation_type','ABC')
with open(get_path_for_OpenDebug_cfg, 'wb') as configfile:
config.write(configfile)
Run Code Online (Sandbox Code Playgroud)
执行代码后,我明白了
[Environment]
automation_type = ABC
Run Code Online (Sandbox Code Playgroud)
";available options: GEM, HEXAII" this line is missing.
Run Code Online (Sandbox Code Playgroud) 我正在尝试从命令行传递源路径和目标路径,如下所示
python ReleaseTool.py -i C:\Users\Abdur\Documents\NetBeansProjects\Exam System -o C:\Users\Abdur\Documents\NetBeansProjects\Release
Run Code Online (Sandbox Code Playgroud)
但是它抛出错误
WindowsError: [Error 3] The system cannot find the path specified: ''
Run Code Online (Sandbox Code Playgroud)
由于“考试系统”之间有一个空格。请建议如何处理。