[python-win32] Error calling client.Dispatch with SQLDMO

Matt Keranen mkn6 at bellsouth.net
Mon Apr 26 11:04:40 EDT 2004


When attempting to set an object as follows:

  import win32com.client
  from win32com.client import DispatchBaseClass
  s = win32com.client.Dispatch('SQLDMO.SQLServer')

I get the error below, but only on the first call. A subsequent call to the exact same Dispatch correctly creates the object. Note that other objects creat without any errors (for example ADODB.Connection).

Any idea how to resolve?:

Traceback (most recent call last):
  File "sqldmo.py", line 3, in ?
    s = win32com.client.Dispatch('SQLDMO.SQLServer')
  File "C:\Python\Lib\site-packages\win32com\client\__init__.py", line 96, in Di
spatch
    return __WrapDispatch(dispatch, userName, resultCLSID, typeinfo, UnicodeToSt
ring, clsctx)
  File "C:\Python\Lib\site-packages\win32com\client\__init__.py", line 38, in __
WrapDispatch
    klass = gencache.GetClassForCLSID(resultCLSID)
  File "C:\Python\Lib\site-packages\win32com\client\gencache.py", line 179, in G
etClassForCLSID
    mod = GetModuleForCLSID(clsid)
  File "C:\Python\Lib\site-packages\win32com\client\gencache.py", line 232, in G
etModuleForCLSID
    __import__(sub_mod_name)
  File "C:\Python\lib\site-packages\win32com\gen_py\10010001-E260-11CF-AE68-00AA
004A34D5x0x8x0\_SQLServer2.py", line 27, in ?
    class _SQLServer2(DispatchBaseClass):
NameError: name 'DispatchBaseClass' is not defined





More information about the Python-win32 mailing list