Search code examples
c#pythoncpython

How C# use python program?


If it doesn't use ironpython, how C# use cpython program(py file)?

Because there are some bugs that ironpython load cpython code.


Solution

  • If you need strict CPython behavior and do not want to change Python program I am afraid that in this case you should spawn separate CPython process and interact with it via some RPC protocol (there are plenty to choose from) via pipe or network connection to localhost.

    As alternative to "serialized" RPC you might use system's facilities e.g. COM if you're on Windows or D-Bus on Linux - but this would make code platform dependent and not necessarily simpler.