Tuesday, May 4, 2010

python and .net – unlikely symbiosis

 

If you love python and want to use all the libraries of python but you also need to work on .NET projects. You might be tempted to look at IronPython…but unless MS openly supports IronPython in VS and also all those libraries that makes Python such a kick ass language, you should skip it.

On the other hand, I found “pythonnet”, this is probably one of the best answer on using python and .net . 

http://pythonnet.sourceforge.net/readme.html

All you need to do is copy the clr.pyd file to ur python installation directory and also the python.runtime.dll file and you can do things  like …

import clr
import System.Windows.Forms as WinForms
from System.Drawing import Color, Size, Point
from System.Text import Encoding
from System.IO import File
import System

class Wordpad(WinForms.Form):
    """A simple example winforms application similar to wordpad."""

 

Cool like hell!.

2 comments:

  1. Have you seen Visual Studio Tools for IronPython? This is how Microsoft is supporting IronPython in Visual Studio (and it's pretty cool).

    http://ironpython.net/ironpython/tools/

    I just use a normal Python IDE though.

    ReplyDelete
  2. Hi Michael,
    Cool but won't be of any use until its officially supported. The question is, when would it be officially supported and release side-by-side VS.

    ReplyDelete