[IronPython] Revisiting interfaces and COM

Alex Willmer alex at moreati.org.uk
Sun Mar 15 12:40:05 CET 2009

>From IronPython I'm calling ArcObjects, a large COM library that uses
interfaces extensively. A .NET interoperability library is provided by
the vendor.

Currently I'm calling these interfaces as follows, but it's getting
verbose very quickly:

IFooBar.Foo(object, arg) # Foo is a method
IFooBar.Bar.GetValue(object) # Bar is a property
IFooBar.Bar.SetValue(object, value)

In 2006 Seo Sanghyeon proposed, as documented in issue 1506 [1]:

wrapper = IFooBar(object)
wrapper.Bar = value

That issue has been closed, presumably fixed. However when I try this
cast with one of the interfaces in ArcObjects it fails. (I don't have
the exception to hand, so I can't include it right now. I'll post a
follow up with the details.)

- Was Seo's proposal implemented? Should I be able to cast/wrap an
instance of an object that implements IFooBar to IFooBar in IronPython
- Is some extra step needed for this, when working with a COM library?
- Does how a COM interface has been implemented/exposed to .NET
matter, wrt to how IronPython treats it?

With thanks, Alex

[1] http://www.codeplex.com/WorkItem/View.aspx?ProjectName=IronPython&WorkItemId=1506
Alex Willmer <alex at moreati.org.uk>

More information about the Ironpython-users mailing list