This problem seems to be related to a post from a while back
http://markmail.org/message/moyolyvs5i26vbwr

It all comes down to the getevents(clsid) function defined in
win32com/client/__init__.py

This function expects an incoming clsid, but it never is one. The incoming clsid
is _actually_ the IID of the dispatch pointer, derived in from:

      ti = disp._oleobj_.GetTypeInfo()
      disp_clsid = ti.GetTypeAttr()[0]

The so-called "disp_clsid" will always return the IID of the dispatch interface.
Usually, this will still work with the gencache which will map the IID to the
class that defines that interface. As long as that class contains a definition
for coclass_clsid, it will eventually get to the true coclass class, which will
define the default source interface e.g.:

    # return default outgoing interface for that class
    klass = gencache.GetClassForCLSID(clsid)
    try:
      return klass.default_source
    except AttributeError:
      # See if we have a coclass for the interfaces.
      try:
        return gencache.GetClassForCLSID(klass.coclass_clsid).default_source
      except AttributeError:
        return None

However, in our particular applications several different type libraries will
import the same interface (and hence IID), which means the look into
GetClassForCLSID will fail since it is really passed an IID which is defined in
multiple different type libraries.

This appears to be a bug relating to thinking the line disp_clsid =
ti.GetTypeAttr()[0] will return a CLSID, when it really returns the IID of the
interface.

_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to