[IronPython] Examples for calling IronPython from  C#

Seshadri Pillailokam Vijayaraghavan seshapv at microsoft.com
Sun Dec 7 00:02:09 CET 2008

See if this helps - http://blogs.msdn.com/seshadripv/archive/2008/06/30/how-to-invoke-a-python-function-from-c-using-the-dlr-hosting-api.aspx

However, the sample will not compile as some of the runtime initialization APIs have changed since that sample was posted. To fix this replace the 'ScriptRuntime.Create()' in this line line - 'ScriptEngine pyEng = ScriptRuntime.Create().GetEngine("python");' with

'IronPython.Hosting.Python.CreateRuntime();'. The new line should look like ' ScriptEngine pyEng = IronPython.Hosting.Python.CreateRuntime().GetEngine("python");'

Let me know if you have any questions or need some information on this.

-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of M. Whitener
Sent: Saturday, December 06, 2008 2:55 PM
To: Users at lists.ironpython.com
Subject: [IronPython] Examples for calling IronPython from  C#

Is there a good source of documentation on how to use functions and
classes in an IronPython program from C#?
I need info on how to do this using C# 3.0 or lower - in other words
_not_ using C# 4.0 dynamic types.
The only example I have found is a very incomplete one from Alex Turner
given at PDC 2008.
Thanks in advance.

Users mailing list
Users at lists.ironpython.com

More information about the Ironpython-users mailing list