Импорт C# скриптов в IronPython - PullRequest
0 голосов
/ 14 апреля 2020

Я пытаюсь написать программу автоматизации на Iron Python, которая объединяет написанное C# написанное программное обеспечение, поэтому мне нужно импортировать модули C#. Везде, куда я смотрел, интегрируется python в C#, что противоположно тому, что я хочу сделать.

У меня есть сценарии C# в том же каталоге, что и мой сценарий Iron Python. Как я могу импортировать скрипты? Насколько я знаю clr.AddReferece() добавляет только ссылки на DLL? Если я напишу clr.AddReference('my_cs_script'), я получу ошибку ввода-вывода.

IOError: System.IO.IOException: Could not add reference to assembly my_cs_script
   at IronPython.Runtime.ClrModule.AddReference(CodeContext context, String name)
   at IronPython.Runtime.ClrModule.AddReference(CodeContext context, Object[] references)
   at Microsoft.Scripting.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.LightLambda.Run4[T0,T1,T2,T3,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3)
   at IronPython.Compiler.Ast.CallExpression.Invoke1Instruction.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.LightLambda.Run1[T0,TRet](T0 arg0)
   at IronPython.Compiler.RuntimeScriptCode.InvokeTarget(Scope scope)
   at IronPython.Hosting.PythonCommandLine.RunFileWorker(String fileName)
   at IronPython.Hosting.PythonCommandLine.RunFile(String fileName)

Спасибо за помощь. Я очень новичок в этом.

...