我在 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())
“我的”代码基于 this和 that .
最佳答案
你可以做:
engine = Python.CreateEngine({'FullFrames': True})
并且将启用全帧。所有其他选项都与命令行选项匹配。
关于ironpython - 如何将选项传递给新的 IronPython 引擎?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2304136/