[python-win32] Dynamic dispatching and AttributeErrors,

Brian Merrell brian at merrells.org
Thu Nov 18 07:45:32 CET 2010


Thanks for the response Mark.  My results inline below:

 mod = win32com.gencache.EnsureModule(...)
>
>>print mod
<module 'win32com.gen_py.4F640F61-3090-4F7D-990C-0056BE2B436Bx0x10x0' from
'c:\python26\lib\site-packages\win32com\gen_py\4F640F61-3090-4F7D-990C-0056BE2B436Bx0x10x0.py'>

> ob = win32com.client.Dispatch(...)
>
>>ob
<COMObject ConcordanceServer>
>>print ob
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "c:\python26\lib\site-packages\win32com\client\dynamic.py", line 197,
in __str__
    return str(self.__call__())
  File "c:\python26\lib\site-packages\win32com\client\dynamic.py", line 182,
in __call__
    return
self._get_good_object_(self._oleobj_.Invoke(*allArgs),self._olerepr_.defaultDispatchName,None)
pywintypes.com_error: (-2147319779, 'Library not registered.', None, None)
 # convert from dynamic to makepy supported.

> ob = mod.GeneratedClassName(ob)
>
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'GeneratedClassName'

   * When I try calling a known method on the returned COM object I get

>
>>      an AttributeError
>>    * I've also tried using every CLSID I can find in my skeleton file c
>>      = Dispatch(CLSID) which results in either a "Class not registered"
>>      or an object that also gives an AttributeError for a known method.
>>
>
> A traceback would be useful here - if the object really is a dynamic
> object, an AttributeError implies that the object itself also doesn't think
> the attribute exists (as dynamic objects ask the object for the attribute
> before raising an AttributeError).
>
I am calling a method listed in the gen_py file so I am not sure how the
attribute could not exist (I was careful about capitalization.  I can
post/send a very abbreviated version of this file (just the wrapper stuff
and a single method) if it would help.

Thanks!

-brian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20101118/0f24c563/attachment.html>


More information about the python-win32 mailing list