[IronPython] COM Object Issue

Zaur Shibzoukhov szport at gmail.com
Wed Nov 26 10:50:53 CET 2008


What will happen with the item-like access to COM objects in IP 2.0?

Whether it will return to []-like access (as in RC 1) or it will
remain .Item(...)?
IMHO RC 1 way is more preferred.

Best regards,
Zaur

2008/10/27 Dino Viehland <dinov at microsoft.com>:
> Oh, and I'm not sure if this is by design or not (I'll need to ping the DLR team), but it seems you can do:
>
> wd.Variables.Item('foo')
>
> instead.
>
> -----Original Message-----
> From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Dino Viehland
> Sent: Monday, October 27, 2008 7:44 AM
> To: Discussion of IronPython
> Subject: Re: [IronPython] COM Object Issue
>
> Is the exception you're seeing "Error while invoking Item"?  Just want to make sure I'm seeing the same thing and the actual exception is cut off in your snippet below.
>
> -----Original Message-----
> From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Zaur Shibzoukhov
> Sent: Monday, October 27, 2008 12:51 AM
> To: users at lists.ironpython.com
> Subject: [IronPython] COM Object Issue
>
> There is an error in RC 1:
>
> IronPython 2.0 (2.0.0.0) on .NET 2.0.50727.1433
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import System
>>>> wa = System.Activator.CreateInstance(System.Type.GetTypeFromProgID("Word.Application"))
>>>> wd = wa.Documents.Add()
>>>> wd.Variables.Add("foo")
> <System.__ComObject (Variable) object at 0x000000000000002B>
>>>> wd.Variables["foo"]
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
>
> In IronPython Beta 5 it worked as expected:
>
> IronPython 2.0 Beta (2.0.0.5000) on .NET 2.0.50727.1433
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import System
>>>> wa = System.Activator.CreateInstance(System.Type.GetTypeFromProgID("Word.Application"))
>>>> wd = wa.Documents.Add()
>>>> wd.Variables.Add("foo")
> <System.__ComObject (Variable) object at 0x000000000000002B>
>>>> wd.Variables["foo"]
> <System.__ComObject (Variable) object at 0x000000000000002C>
>
> Best regards,
> Zaur
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
> _______________________________________________
> Users mailing list
> Users at lists.ironpython.com
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>



More information about the Ironpython-users mailing list