EnsureDispatch will not generate in frozen applications. You can
specify 'typelibs' in the py2exe options dict. The format is the same as
passed to EnsureModule and printed by "makepy -i" eg, to include the
MSOffice typelib you could say:
py2exe_options = {
'typelibs':
[
('{
Hello win32,
Python 2.4
Problem:
Works fine when running python test.py but fails when executing test.exe.
[Note test.exe was created using py2exe]
conn = win32com.client.gencache
.EnsureDispatch('ADODB.Connection')
conn.Open("Provider='SQLOLEDB';Data Source='.';Initial Catalog='mydatabase';