Run Python and C # together

5

How can I in C # import, that is, execute some script in another language (Python)?

Example: If you write "R" in a program in C #, it executes a file named ApertouR.py .

    
asked by anonymous 27.12.2017 / 13:59

3 answers

2

27.12.2017 / 14:10
4

You have Python.NET and should be the most appropriate one. In some cases you can use IronPython . This way both languages can work on the same platform and coexist.

There are other ways, but I think a lot of gambiarra. One is to call the interpreter externally as a normal application. Too much can go wrong in this. It is a valid option, but it is not the most reliable.

It would be good to think if you even need this if you do not have a better solution. We can not help much more because the question does not tell the scenario where it will be used. You may not even need Python.

    
27.12.2017 / 14:04
-1

You can make a system call

Process.start(@"python C:\ApertouR.py")

But I do not know what kind of application this is.

    
27.12.2017 / 14:11