views:

207

answers:

1

I'm running pywin32 for python 2.5.

I'm following the instructions for python ADO given at http://www.ecp.cc/pyado.html.

Creating an ADODB.Recordset object works fine. But when I try to create an ADOX.Catalog object I get an error:

>>> cat=win32com.client.Dispatch(r'ADOX.Catalog')
Traceback (most recent call last):
  File "<interactive input>", line 1, in <module>
  File "C:\Python25\lib\site-packages\win32com\client\__init__.py", line 95, in Dispatch
    dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)
  File "C:\Python25\lib\site-packages\win32com\client\dynamic.py", line 98, in _GetGoodDispatchAndUserName
    return (_GetGoodDispatch(IDispatch, clsctx), userName)
  File "C:\Python25\lib\site-packages\win32com\client\dynamic.py", line 78, in _GetGoodDispatch
    IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch)
com_error: (-2147024770, 'The specified module could not be found.', None, None)

Any ideas what I might be missing?

+2  A: 

Solution: even though ADOX was showing up in the COM browser as an available library, it wasn't "registered" properly. Following the instructions here, I executed the following at the Start->Run prompt:

regsvr32 "C:\Program Files\Common Files\System\ado\msadox.dll"

Note that this is on a WinXP SP2 machine. I guess the registry had become corrupt somehow? In any case, I'm new to Windows programming so my explanation may be off, but maybe the fix will help someone.

mikeh