[python-win32] How to figure out the COM object name?

Michael March mmarch at gmail.com
Wed Apr 4 00:19:28 CEST 2007


Here is what I get when I try that...

>>> td = win32com.client.Dispatch("TDConnection")
Traceback (most recent call last):
  File "<interactive input>", line 1, in ?
  File "C:\Python24\lib\site-packages\win32com\client\__init__.py",
line 95, in Dispatch
    dispatch, userName =
dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)
  File "C:\Python24\lib\site-packages\win32com\client\dynamic.py",
line 98, in _GetGoodDispatchAndUserName
    return (_GetGoodDispatch(IDispatch, clsctx), userName)
  File "C:\Python24\lib\site-packages\win32com\client\dynamic.py",
line 78, in _GetGoodDispatch
    IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx,
pythoncom.IID_IDispatch)
com_error: (-2147221005, 'Invalid class string', None, None)

On 4/3/07, Tim Roberts <timr at probo.com> wrote:
> Michael March wrote:
> > I am trying to connect to a COM object.. and I can't figure how to code it..
> >
> > In Makepy the name of the COM object is:
> >    OTA COM 9.0 Type LIbrary (1.0)
> >
> > The DDL is:
> >    OTAClient.dll
> >
> > The VB samples have stuff like this..
> >    Dim td as New TDConnection
> >    td.InitConnectionEx "http://<servername>:port/qcbin"
> >    etc...
> >
> > What should my.....
> >    obj=win32com.client.Dispatch("...........
> > ...look like?
> >
>
> It should be as simple as
>     td = win32com.client.Dispatch( "TDConnection" )
>     td.InitConnectionEx( "http://server:port/qcbin" )
>
> That is, assuming they support late binding.
>
> --
> Tim Roberts, timr at probo.com
> Providenza & Boekelheide, Inc.
>
>
> ______________________________________________


More information about the Python-win32 mailing list