[Tutor] IronPython any tutors with experience out there?

Wayne Werner wayne at waynewerner.com
Mon Jan 7 06:38:24 CET 2013


On Thu, 3 Jan 2013, Bjorn Madsen wrote:

> Hello PythonTutor- I'm a scientist and very happy with python 2.7. I have been asked to assist a development program where everything is written in dotNET/
> C# (visual studio 2012) and luckily Microsoft Visual Studio supports IronPython which is a clean Python implementation in C#, so I can use the Python
> syntax I'm so familiar with... 
> 
> However ... to interact with the c# modules which my colleagues wrote, I need to add "clr" references.
> 
> Example:
> >>> import clr
> >>> clr.AddReferenceToFile("Mapack.dll")
> >>> from Mapack import *
> >>> dir()
> 
> Unfortunately I can't get it to run and the tutorials after 12 hours of google-reading are terribly sparse. Is there any experience somewhere in the
> network with IronPython in VSTO-2012 in this forum and what could the top five clr.addreference bugs be?

Assuming everything else checks out... what you have to import is the namespace
of whatever the .dll is. So if it was compiled with a root namespace of say,

     Fizz.Buzz.Foo

Then you'll have to do:

     from Fizz.Buzz.Foo import *

Though, I've never tried that version. I always did

     import Fizz.Buzz.Foo as foo

in my own code.
HTH,
Wayne


More information about the Tutor mailing list