Problem setting COM property using win32com
Paul Prescod
paul at prescod.net
Mon Apr 7 16:33:57 EDT 2003
I don't know why that's happening, but I would suggest you take more
control of the instantiation by doing something like this:
from win32com.client.gencache import EnsureModule
MyModule = EnsureModule('{3BBEE982-742B-11D2-BD0A-00A024C36143}', 0, 1, 0)
reclist = MyModule.SmRecList()
In my recent COM project, I used the "dispatch" mechanism and pythoncom
was smart enough to pick up my gen_py'd module. But the mechanism above
is fine too. In fact, it is probably better by virtue of being more
explicit...
Green, Gregory P wrote:
> I don't think the gen_py class is being used:
>
> print obj: <COMObject SmRecList.SmRecordList>
>
> print obj.__class__: win32com.client.CDispatch
>
> print dir(obj): ['_ApplyTypes_', '_LazyAddAttr_', '_NewEnum', '_Release_', '__AttrToID__', '__LazyMap__', '__call__', '__cmp__', '__doc__', '__getattr__', '__getitem__', '__init__', '__int__', '__len__', '__module__', '__nonzero__', '__repr__', '__setattr__', '__setitem__', '__str__', '_builtMethods_', '_enum_', '_find_dispatch_type_', '_get_good_object_', '_get_good_single_object_', '_lazydata_', '_make_method_', '_mapCachedItems_', '_oleobj_', '_olerepr_', '_print_details_', '_proc_', '_unicode_to_string_', '_username_', '_wrap_dispatch_']
More information about the Python-list
mailing list