[IronPython] Examples_for_calling_IronPython_from_ C#

M. Whitener mbw.05 at multiparadigm.com
Sun Dec 7 03:40:12 CET 2008


Sesh, after your changes (below), and replacing using System.Scripting
with using Microsoft.Scripting
it works!

This is great.  Thank you.

You mentioned that planned to post some code showing how to call python
class instance methods.  Did you have a chance to do that?

Thanks again!


-------- Original Message --------
Subject: Re: [IronPython] Examples_for_calling_IronPython_from_  C#
From: Seshadri Pillailokam Vijayaraghavan <seshapv at microsoft.com>
Date: Sat, December 06, 2008 5:02 pm
To: Discussion of IronPython <users at lists.ironpython.com>

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.

Thanks
Sesh
-----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
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

_______________________________________________
Users mailing list
Users at lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com






More information about the Ironpython-users mailing list