Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to embed IronPython in a .NET application

Is it possible to expose an API in a .NET application by embedding a scripting language like IronPython?

How is it done?

like image 622
guillermooo Avatar asked Oct 16 '08 12:10

guillermooo


People also ask

Is IronPython the same as Python?

Python is Python, the only difference is that IronPython was designed to run on the CLR (. NET Framework), and as such, can inter-operate and consume . NET assemblies written in other .

Is IronPython a framework?

NET Framework. IronPython works as an extension to the . NET Framework, but it can also be used by . NET projects to take advantage of Python's scripting power.

Does IronPython compile?

IronPython is a Python compiler. It compiles Python code to in memory bytecode before execution (which can be saved to disk, making binary only distributions possible).


1 Answers

IronPython has a hosting API which can be used to execute IronPython scripts from a C#\VB application.

This is a good example of embedding IronPython inside a winforms app.Note that the hosting APIs have changed since that post. This post shows an example of the latest API

You can find the latest specs here [Note: URL throws a 404 as of 2010-09-07]

like image 117
Srivatsn Narayanan Avatar answered Nov 09 '22 19:11

Srivatsn Narayanan