2010-02-20 27 views
4

我在IronPython內託管IronPython。我沒有找到用相當於命令行參數的方式初始化它的方法:-X:FullFrames如何將選項傳遞給新的IronPython引擎?

我的代碼是有點像:

import clr 
clr.AddReference('IronPython') 
clr.AddReference('Microsoft.Scripting') 
from IronPython.Hosting import PythonCommandLine, PythonConsoleOptions, Python 
clr.AddReference('Microsoft.Dynamic') 
clr.AddReference('System') 
import System 
from Microsoft.Scripting.Hosting.Shell import IConsole 

engine = Python.CreateEngine() 
runtime = engine.Runtime 
for assembly in clr.References: 
    runtime.LoadAssembly(assembly) 

cmdLine = PythonCommandLine() 
runtime.Globals.SetVariable('cur_cmdLine',cmdLine) 

cmdLine.Run(engine, my_console(), PythonConsoleOptions()) 

「我」 的代碼是基於thisthat

回答

6

你可以這樣做:

engine = Python.CreateEngine({'FullFrames': True}) 

和全幀將被啓用。所有其他選項與命令行選項相匹配。