[python-win32] Strange/impossible Python COM interface behavior

Mark Hammond mhammond at skippinet.com.au
Thu Jul 5 01:09:31 CEST 2007


> from win32com.client import DispatchBaseClass
>
> I'm unable to find DispatchBaseClass and so can not chase the
> issue further

Its in win32com.client.__init__.py

> (never mind that I'm a bit over my head in the Win32Com code).
> Interestingly, __repr__ is NOT in the GenPY output code, so I
> assume it is
> also in DispatchBaseClass.  I'm guessing that _ApplyTypes_ is
> misbehaving
> but am not sure.
>
> In any event, thanks for your assistance.  While not resolved
> the problem is
> not critical since it only involves print and there is a work
> around via ``.
> Hopefully, Mark will pick up this thread and be able to shed
> a bit of light.

I'm afraid I don't understand the problem you are currently trying to
demonstrate.  Doing str(com_obj) will attempt to use the com object's
"default" method or property and use that, while 'repr' does not.  This is
mainly done for things like ADO 'field' objects, where the default method
fetches the value for the field, for example.

Mark



More information about the Python-win32 mailing list