【发布时间】:2014-06-25 18:57:11
【问题描述】:
我正在使用 c# 调用一个 Iron python 脚本
ScriptRuntimeSetup setup = Python.CreateRuntimeSetup(null);
ScriptRuntime runtime = new ScriptRuntime(setup);
ScriptEngine engine = Python.GetEngine(runtime);
ScriptSource source = engine.CreateScriptSourceFromFile("C:/KitGenerator/KitGenerator/LoadKitsFromDatabase.py");
ScriptScope scope = engine.CreateScope();
source.Execute(scope);
这工作正常,并且使用打印输出我已经证明代码运行正确。 然而,在 Iron python 脚本内部是对另一个 python 脚本的调用
os.system("ipython C:\KitGenerator\Kit-Generator\GenerateKitImages.py")
(我只用 (ipython "GenerateKitImages.py") 尝试过)
问题: 当我使用 Ipy.exe 运行第一个 Iron python 脚本时,它们都运行得非常好并且按预期运行。 但是,当我使用 c# 脚本引擎运行第一个 Iron python 脚本时,它只运行第一个脚本,而第二个脚本永远不会被调用。
我迷路了。我可以确认这与权限、依赖项无关。
给能解决这个问题的人的金牌和披萨。
【问题讨论】:
标签: c# python asp.net python-2.7 ironpython