_oleobj_ and dir

Alex Martelli aleaxit at yahoo.com
Sun Dec 10 23:11:25 CET 2000

<yelled at yahoo.com> wrote in message news:910lpp$p2g$1 at nnrp1.deja.com...
> Hi,
>  I am trying to get available functions and attributes of COM obj:

Two steps: first, you must ensure that the Python wrappers for
the typelibrary you're using are on -- the simplest way may be
to use:
adoConn = win32com.client.gencache.EnsureDispatch('ADODb.connection')
rather than:
adoConn = win32com.client.Dispatch('ADODb.connection')

Once that is done, dir(adoConn.__class__) will give you, among
other things, the COM methods of the class:

>>> print dir(adoConn.__class__)
['BeginTrans', 'CLSID', 'Cancel', 'Close', 'CommitTrans', 'Execute', 'Open',
enSchema', 'RollbackTrans', '__call__', '__doc__', '__int__', '__module__',
tr__', '_prop_map_get_', '_prop_map_put_']

CLSID is the CLSID, and the names starting with '__' are Python-special
ones.  But _prop_map_get_ and _prop_map_put_ are of direct
interest to your purpose -- they're dictionaries (for all properties,
and R/W properties only, respectively) whose keys are the various
property names (never mind the associated values).


More information about the Python-list mailing list