Has anyone had any experience embedding a CPython engine in a .NET
application? In the COM/ActiveX world, it was pretty easy to use Mark
Hammond's win32 modules to create a script engine component that you could
expose other COM objects to, but I was not sure how I would go about doing
something similar in a .NET environment. For example, something like:
.... .NET Application code ...
'Create Foo object.
set Foo = New Foo("baz")
'Create embedded cpython script engine.
set engine = New CPythonEngine()
'Expose Foo object to engine.
engine.AddNamed Item(Foo, "Foo")
'Load python script.
engine.LoadScri pt("D:\scripts\ frotz.py")
'Run script (uses Foo).
engine.Run()
'Get results'
set resultsCollecti on = engine.getResul ts()
Is something like this possible, or am I thinking about things the wrong
way?
I am mainly interested in knowing if this is possible with cpython, as I
understand IronPython is currently in beta.
Thanks.
application? In the COM/ActiveX world, it was pretty easy to use Mark
Hammond's win32 modules to create a script engine component that you could
expose other COM objects to, but I was not sure how I would go about doing
something similar in a .NET environment. For example, something like:
.... .NET Application code ...
'Create Foo object.
set Foo = New Foo("baz")
'Create embedded cpython script engine.
set engine = New CPythonEngine()
'Expose Foo object to engine.
engine.AddNamed Item(Foo, "Foo")
'Load python script.
engine.LoadScri pt("D:\scripts\ frotz.py")
'Run script (uses Foo).
engine.Run()
'Get results'
set resultsCollecti on = engine.getResul ts()
Is something like this possible, or am I thinking about things the wrong
way?
I am mainly interested in knowing if this is possible with cpython, as I
understand IronPython is currently in beta.
Thanks.
Comment