327 self.python_runtime_vars["FBID"]=FBID |
327 self.python_runtime_vars["FBID"]=FBID |
328 ccmd,AST =compile_cache.get(FBID, (None,None)) |
328 ccmd,AST =compile_cache.get(FBID, (None,None)) |
329 if ccmd is None or ccmd!=cmd: |
329 if ccmd is None or ccmd!=cmd: |
330 AST = compile(cmd, '<plc>', 'eval') |
330 AST = compile(cmd, '<plc>', 'eval') |
331 compile_cache[FBID]=(cmd,AST) |
331 compile_cache[FBID]=(cmd,AST) |
332 result,exp = self.evaluator(eval,cmd,self.python_runtime_vars) |
332 result,exp = self.evaluator(eval,AST,self.python_runtime_vars) |
333 if exp is not None: |
333 if exp is not None: |
334 res = "#EXCEPTION : "+str(exp[1]) |
334 res = "#EXCEPTION : "+str(exp[1]) |
335 self.LogMessage(1,('PyEval@0x%x(Code="%s") Exception "%s"')%(FBID,cmd, |
335 self.LogMessage(1,('PyEval@0x%x(Code="%s") Exception "%s"')%(FBID,cmd, |
336 '\n'.join(traceback.format_exception(*exp)))) |
336 '\n'.join(traceback.format_exception(*exp)))) |
337 else: |
337 else: |