APIスクリプトに変更があります。
C#でIronPythonのを使用するには:
1)、あなたのデモを実行して、あなたのコード変更するには)
Install-Package IronPython.StdLib
Install-Package IronPython
2 Nugetパッケージをインストールします。
// ScriptRuntime runTime = ScriptRuntime.Create(); //create is not available
ScriptRuntime runTime = ScriptRuntime.CreateFromConfiguration();
3)を使用してアセンブリ:
using IronPython.Hosting;
using Microsoft.Scripting;
using Microsoft.Scripting.Hosting;
4) App.configファイルに次の行を追加します。
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="microsoft.scripting" type="Microsoft.Scripting.Hosting.Configuration.Section, Microsoft.Scripting"/>
</configSections>
<microsoft.scripting>
<languages>
<language names="IronPython;Python;py" extensions=".py" displayName="IronPython" type="IronPython.Runtime.PythonContext, IronPython"/>
</languages>
私は2013対でコードをテストし、それがエラーなしで働いています。
エラーストリームもキャッチし、エラーがないことを確認してください。 –
はい。 ErrorStreamに例外があります。 '((System.IO .__ ConsoleStream)runTime.IO.ErrorStream).Length'は、型 'System.NotSupportedException' 2( 'System.IO .__ ConsoleStream)runTimeの例外をスローしました。 IO.ErrorStream).Position 'が' System.NotSupportedException 'タイプの例外をスローしました3]' runTime.IO.ErrorStream.ReadTimeout 'が' System.InvalidOperationException'4 '型の例外をスローしました' runTime.IO.ErrorStream.WriteTimeout 'throw 'System.InvalidOperationException'型の例外です。さっき気付いた。さらに、Input、OutputストリームはRead/write TimeOutExceptionをスローし続けます。 – Harpreet