[python-win32] (no subject)

Mark Hammond mhammond at skippinet.com.au
Tue May 10 00:38:53 CEST 2005

"SRS_CONLib.Point2D" is not the "ProgID" of the object - it is the name of
the typelib and interface in that typelib.

If your object can be used with Dispatch, it should be possible to create
the object in VB using "CreateObject" - CreateObject wants the ProgID too -
ie, it will fail with "SRS_CONLib.Point2D".  Whatever you can pass to
CreateObject can be passed to Python's dispatch.

Ask the developer what the "ProgID" of the object is.


-----Original Message-----
From: python-win32-bounces at python.org
[mailto:python-win32-bounces at python.org]On Behalf Of eric.powell at srs.gov
Sent: Tuesday, 10 May 2005 2:55 AM
To: python-win32 Mailinglist
Subject: [python-win32] (no subject)

Hello again, all-

I am still trying to understand Windows COM from Python. This time, I am
trying to access a custom COM object an in-house developer has developed in
C++. The class is stored in a dll registered with my system, and can be
called from VB as follows:

>From a working VB project:

 ' set up the input
  Dim pConv As New SRS_CONLib.Point2D

However, when I try to call the clas via win32com, I get error messages.

In Python:

srs = win32com.client.Dispatch(r'SRS_CONLib.Point2D')

The error:

Traceback (most recent call last):
  File "<pyshell#13>", line 1, in -toplevel-
    srs = win32com.client.Dispatch(r'SRS_CONLib.Point2D')
  File "C:\PYTHON23\lib\site-packages\win32com\client\__init__.py", line 95,
in Dispatch
    dispatch, userName =
  File "C:\PYTHON23\lib\site-packages\win32com\client\dynamic.py", line 84,
in _GetGoodDispatchAndUserName
    return (_GetGoodDispatch(IDispatch, clsctx), userName)
  File "C:\PYTHON23\lib\site-packages\win32com\client\dynamic.py", line 72,
in _GetGoodDispatch
    IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx,
com_error: (-2147221005, 'Invalid class string', None, None)

The developer tells me the IDispatch interface is enabled, and the
SRSCON_Lib.Point2D should be in the registry.

Thanks in advance for any assistance....


Eric B. Powell

When a true genius appears in this world you may know him by this sign, that
the dunces are all in confederacy against him. (Swift)

More information about the Python-win32 mailing list