[IronPython] "TypeError: Microsoft.Scripting.DynamicType is not callable" bug(?)
storm.openmail at gmail.com
Wed Jul 11 07:44:32 PDT 2007
We have a number of Python scripts that we use for updating and setting up
the devices my company make. We do this through calls to a number of COM
classes via win32com.client.Dispatch().
We are interested in being able to call these Python scripts from various
.NET GUI applications written in C# so naturally I started looking into
My goal is to make our CPython code as executable in IronPython as humanly
possible so since win32com is not available through IronPython I wrote a
simple C# interop wrapper handling the interops for the specific COM classes
we need to call when setting up our devices:
public class client
public static object Dispatch(string comName)
The annoying thing is that this "hack" works like a charm except in one type
Some of our COM classes return Item collections that are indexable by both
specific names (string indexing) and normal int indexes
- example in CPython:
This works like a charm in CPython (and the interop version of our C# code
for that matter) but it does NOT work in IronPython.
In IronPython 1.1 I get this error message "TypeError: object is not
In IronPython 2.0 alpha 3 I get this error message: "TypeError:
Microsoft.Scripting.DynamicType is not callable".
I can access the properties of the object such as item count however I
cannot index into the result object by calling result.get_Item("ItemName").
It gives the following error message
TypeError: multiple overloads of get_Item could match (String)
nor can I index into the result object by calling result.get_Item(0) which
gives a similar error except the problematic match is Int32.
So apparently IronPython cannot identify the type of the index objects when
more are present?
Anyone have any comments that can help me here? Have I missed some subtle
issues with COM interop? Is this a known bug and if so when do you think it
will be fixed?
(I know I can get around the problem by writing specific IronPython code +
changing the handling of the COM class in my C# wrapper but I REALLY don't
want to nor should I have to if the goal is to make IronPython as clean as
possible port of CPython.)
Great initiative and great work otherwise in the port
Martin Storm Møller
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the users