[python-win32] Re: OE/WAB help with VB ...
Roger Upole
rwupole at msn.com
Mon Mar 10 20:07:41 CET 2008
Clinton Lee Taylor wrote:
> I think I get this because com objects have to be "imported" ... But
> this ActiveX object does not seem to have a "type lib"? ...
It appears the type info is embedded in the dll itself, rather than
shipped as a separate .tlb.
> So I tried the following ...
>
> import win32com.client
> n=win32com.client.gencache.EnsureDispatch("NKTWABLib.NKTWAB")
> print n
>
> and I get ...
>>>>
> <win32com.gen_py.Nektra NKTWAB library.INKTWAB instance at 0x20367160>
>>>>
>
>
> Again, I tried ...
> import win32com.client
>
> n=win32com.client.gencache.EnsureDispatch("NKTWABLib.NKTWAB")
> print n
>
> r=n.RootFolder
> print r.Folders.Count
>
> and I get ...
>
>>>> ================================ RESTART
>>>> ================================
>>>>
> <win32com.gen_py.Nektra NKTWAB library.INKTWAB instance at 0x20367160>
>
> Traceback (most recent call last):
> File "D:/Hyplex/outlook/Hylapex/WAB-Contacts-03.py", line 6,
> in -toplevel-
> r=n.RootFolder
> File "C:\Python24\Lib\site-packages\win32com\client\__init__.py",
> line 455, in __getattr__
> return self._ApplyTypes_(*args)
> File "C:\Python24\Lib\site-packages\win32com\client\__init__.py",
> line 446, in _ApplyTypes_
> return self._get_good_object_(
> com_error: (-2147352559, 'Does not support a collection.', None, None)
>>>>
>
I get the same error after generating the wrapper from the type info.
Try clearing your \win32com\genpy folder, and run it without the
EnsureDispatch. There may be something wrong with the type
info, but it would take a lot of digging to find out exactly what.
Roger
More information about the python-win32
mailing list