def updateRptPath(self, rptPathName, newScriptName): ''' Writes a new script file and sets internal script name New script writes to 'rptPathName' rptPathName should be a full path name (if possible) ''' if not hasattr(self,'ow'): sys.stderr.write("{:}: 'ow' not defined yet (missing script file?)\n".format(self.__class__)) raise RuntimeError("OpenWind wrapped executable not defined") return e = rwScriptXML.parseScript(self.ow.script_file, debug=self.debug) rp = e.find("ReportPath") if rp is None: sys.stderr.write('Can\'t find report path in "{:}"\n'.format(self.ow.script_file)) return if self.debug: sys.stderr.write('Changing report path from "{:}" to "{:}"\n'.format(rp.get('value'),rptPathName)) rp.set('value',rptPathName) rwScriptXML.wrtScript(e, newScriptName) self.ow.script_file = self.workDir + '/' + newScriptName if self.debug: sys.stderr.write('Wrote new script file "{:}"\n'.format(self.ow.script_file))
def updateRptPath(self, rptPathName, newScriptName): ''' Updates the output report path by writing a new script file ('newScriptName') that includes the new report path ('rptPathName'), then setting the value of ow.script_file to 'newScriptName' (with proper folder) Writes a new script file and sets self.ow.script_file New script is identical to current script, except that it writes to 'rptPathName' rptPathName should be a full path name (if possible) ''' if self.ow is None: sys.stderr.write('*** WARNING: calling updateRptPath() before ow (OpenWind component) is set\n') return e = rwScriptXML.parseScript(self.ow.script_file) rp = e.find("ReportPath") if rp is None: sys.stderr.write('Can\'t find report path in "{:}"\n'.format(self.ow.script_file)) return if self.debug: sys.stderr.write('Changing report path from "{:}" to "{:}"\n'.format(rp.get('value'),rptPathName)) rp.set('value',rptPathName) rwScriptXML.wrtScript(e, newScriptName) self.ow.script_file = self.workDir + '/' + newScriptName if self.debug: sys.stderr.write('Wrote new script file "{:}"\n'.format(self.ow.script_file))
def updateAssyRptPath(self, rptPathName, newScriptName): ''' Updates the output report path by writing a new script file ('newScriptName') that includes the new report path ('rptPathName'), then setting the value of self.script_file to 'newScriptName' (with proper folder) Similar to updateRptPath() but modifies self.script file, since self.ow may not be set yeet ''' e = rwScriptXML.parseScript(self.script_file) rp = e.find("ReportPath") if rp is None: sys.stderr.write('Can\'t find report path in "{:}"\n'.format(self.ow.script_file)) return if self.debug: sys.stderr.write('Changing report path from "{:}" to "{:}"\n'.format(rp.get('value'),rptPathName)) rp.set('value',rptPathName) rwScriptXML.wrtScript(e, newScriptName) self.script_file = self.workDir + '/' + newScriptName if self.debug: sys.stderr.write('Wrote new script file "{:}"\n'.format(self.script_file))