Run python script using C # .NET

1

Good morning.

I'm making an C# .NET application that needs to call a script of python .

I tried to call the script through the library IronPython :

using IronPython.Hosting;
using Microsoft.Scripting.Hosting;

private void processFiles()
            {
                ScriptEngine engine = Python.CreateEngine();
                try
                {
                     engine.ExecuteFile(@"Script.py");
                }
                catch (Exception ex)
                {
                    WriteLine("Error al procesar los archivos: ");
                    WriteLine(ex.Message);
                    procesado = false;
                    return;
                }
            }

But it gives me the following error message:

  

No module named os.path

It means that I can not import libraries inside the script. The question is Is there a way to create a compiled python and run it from .NET? or Is there a way to run the script with all its dependencies?

Thank you in advance.

    
asked by Brayan Zavala 04.01.2018 в 00:02
source

0 answers