0

问题是;

   var instance = mScriptScope.GetVariable("Group1"); //here I can get the instance named "Group1" ,type is IronPython.Runtime.Types.OldInstance
    mScriptScope.Engine.Execute(context);//but here I excute Group1.Collection1.Tag1 =10 throw an UnBoundNameException :  global name 'Group1' is not defined

mScriptScope 是从 .py 文件创建的:

# -*- coding: utf-8 -*- 

import RTDBBase 
from RTDBBase import *
Group1 = PRTDBTagGroup("Group1")

为什么?

4

1 回答 1

0

好的,如果要执行 Group1.Collection1.Tag1 =10,我应该这样做:

  ScriptSource source = mScriptScope.Engine.CreateScriptSourceFromString("Group1.Collection1.Tag1 =10", SourceCodeKind.Statements);
  source.Execute(mScriptScope);
于 2013-03-28T08:21:17.390 回答