interface PyScriptNode : PyNodeBase
{
+ /*!
+ This method compiles, but NOT EXECUTE, the code \a codeStr. The result of the compiled code will be used then
+ on execute step.
+ \param codeStr - the python code (without statement) to be executed, that can modify the context initialized at initialization.
+ */
+ void assignNewCompiledCode(in string codeStr) raises (SALOME::SALOME_Exception);
+
/*! \brief execute a python script defined in the node
\param outargsname output argument names
except:
raise SALOME.SALOME_Exception(SALOME.ExceptionStruct(SALOME.BAD_PARAM,"","PyScriptNode (%s) : code to be executed \"%s\"" %(self.nodeName,code),0))
+ def assignNewCompiledCode(self,codeStr):
+ try:
+ self.code=codeStr
+ self.ccode=compile(codeStr,self.nodeName,'exec')
+ except:
+ raise SALOME.SALOME_Exception(SALOME.ExceptionStruct(SALOME.BAD_PARAM,"","PyScriptNode.assignNewCompiledCode (%s) : code to be executed \"%s\"" %(self.nodeName,codeStr),0))
+
def execute(self,outargsname,argsin):
"""Execute the script stored in attribute ccode with pickled args (argsin)"""
try: