py2exe problems with win32com [ EnsureDispatch('ADODB.Connection') ]

list.repository at gmail.com list.repository at gmail.com
Wed May 25 17:21:04 EDT 2005


Problem:

Works fine when running python test.py but fails when executing
test.exe.


test.py:

conn = win32com.client.gencache.EnsureDispatch('ADODB.Connection')
conn.Open("Provider='SQLOLEDB';Data Source='.';Initial
Catalog='mydatabase';User ID='user';Password='pwd';")
.
.
.

setup.py:(same KeyError)

from distutils.core import setup
import py2exe

setup(console=['test.pyw'],
      options = { "py2exe": { "typelibs":
[('{00000550-0000-0010-8000-00AA006D2EA4}', 0, 2, 8)]
 }
 }
 )

(Doesn't work since its not registered or need to get the

setup.py:  (same KeyError)

from distutils.core import setup
import py2exe

setup(console=['test.pyw'])


Generated error when running test.exe:

Traceback (most recent call last):
  File "test.py", line 66, in ?
  File "test.py", line 57, in main
  File "test.py", line 16, in test_status
  File "win32com\client\gencache.pyc", line 540, in EnsureDispatch
  File "win32com\client\CLSIDToClass.pyc", line 50, in GetClass
KeyError: '{00000550-0000-0010-8000-00AA006D2EA4}'


Solution:

Use a registered typelib that has ADODB.Connection functionality :)



Any suggestions...




More information about the Python-list mailing list