[python-win32] Yet another person confused on static versus dynamic dispatch

Mark Hammond skippy.hammond at gmail.com
Mon May 12 01:39:19 CEST 2014


On 9/05/2014 1:14 AM, Red Gator wrote:
> Sure I can do that. But after this debacle I find I need to know "why".
>
>   * Why does my object come up as "win32com.gen_py.None.Map" when it
>     should come up as 'win32com.gen_py.<<fiddly-GUID-bits>>.Map or even
>     "win32com.gen_py.<<library-descriptiojn-with-dots>>.Map. There was
>     some comment that in this state the object would be unusable,
>     whereas this is the object that I have found actually usable.
>   * Pg 203 "Dispatch()  [checks] to see if MakePy support exists for the
>     object". Well, I KNOW that the MakePy file is being referenced
>     because I've made manual changes to it and have had those changes
>     show up as new behavior in the application. So why doesn't the
>     Layer.com = Dispatch() work as described?

Unfortunately, these 2 are always down to the implementations of the 
object.  When win32com gets an object (eg, as the result of calling some 
function or getting a property) there are ways to ask the object what 
type it is - but this is optional.  In short, if the object doesn't 
describe itself, we don't know what it is.  As that is all down to the 
implementation of the object, there is no single answer to why that is 
sometimes the case.


>   * What is the necessity in the posting where the COM object class is
>     derived from the Dispatch() object, which I don't appear to be doing
>     in the working case?

I'm not sure I understand the question correctly, but the example you 
refer to is a way for you to say "hey - *I* know what type the object is 
even if the object itself doesn't, so use this for the object"

HTH,

Mark



More information about the python-win32 mailing list