-
Notifications
You must be signed in to change notification settings - Fork 2
Closed
Description
The exec function shall be used with a limited scope, according to the concrete needs.
Uses shall look similar to this:
def _bExecuteEvalCode(self,sEvalCode,sErrorMsg=''):
#bResult=False
bResultTmp = False
dLocals = {"self": self, "bResult": False} # self to access dInParams
try:
#print sEvalCode
#Execute the assembled code snipplet
exec(sEvalCode, {}, dLocals)
except Exception as reason:
sMsg="eval code"
if sErrorMsg!='':
sMsg=sErrorMsg
raise Exception(sMsg +" can't be executed: %s \r\nReason: '%s'" % ( str(sEvalCode) , str(reason)))
finally:
pass
return dLocals['bResult']
Metadata
Metadata
Projects
Status
Done