0

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?

0

2 Answers 2

0

Have you looked at IronPython?

There is a whole bunch of information on Stack Overflow including a number of particularly relevant questions such as IronPython - Load script from string in C# 4.0 application.

And plenty more on the web.

Sign up to request clarification or add additional context in comments.

1 Comment

Yes, there are lot of ironpython but based on old method VS2008 or .NET3.5 or earlier. The newer ironpython implementation based on .NET4.0 where it now use dynamic keyword and much simpler but actual document about this class is not available die to ongoing work on document (unless I missed it). At present, there is very limited information even the book does not cover much on this topic (embedded ironpython for .NET4.0)
0

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. 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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.