如何将选项传递给新的IronPython引擎?

Iga*_*ban 4 ironpython

我在IronPython中托管IronPython.我没有找到用相当于命令行参数初始化它的方法:-X:FullFrames.

我的代码有点像:

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())
Run Code Online (Sandbox Code Playgroud)

"我的"代码基于那个.

Din*_*and 6

你可以做:

engine = Python.CreateEngine({'FullFrames': True})
Run Code Online (Sandbox Code Playgroud)

并且将启用完整帧.所有其他选项与命令行选项匹配.