VS2010, C#, Python: Python script file execution on runtime
Question: I wish to create a sample program in C# where it downloaded real time data (ie
datalogger) via USB port. C# accept the data (hex or numerical) and then
automatically download a python file (ie validatemethodA.ps) which is then
executed. The python accept the data from the C# code and then do validation
check on data or do complex calculation and return results back to C#, where
the data is displayed on window form and appended to the file (by C#).

The Python is a script, where it does not requires complies in advance (during
c# runtime) this mean the user is free to modify the python script to optimise
pass/fails parameter or calculation results without getting back to VS2010 to
complies the whole program.

This mean I can supply release C# product and only user can modify the python
file.

How this is achieved?, is there sample/demo, can anyone link me to this
solution so I can experiment this proof of concept?


Answer: There are a couple of ways to do this...one would be to "shell out" to Python
by invoking a system call from your C# program. There, you would be looking to
use the .NET runtime Process.Start method to run the Python interpreter as a
subprocess from your C# program.

Another option would be to use a tighter integration between C# and Python by
using the [IronPython interpreter](http://ironpython.codeplex.com/).
IronPython (ipy), is the python interpreter implemented in .NET ipy can run
Python code (essentially the same as normal "c" python, but with some
differences), but can also import .NET assemblies and interact with the .NET
runtime, directly.

