472,135 Members | 1,325 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,135 software developers and data experts.

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

Problem:

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

conn = win32com.client.gencache.EnsureDispatch('ADODB.Con nection')
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...

Jul 19 '05 #1
2 4019
I'm not positive about this, but when using com you need to force it
into the compile. In my applications where I use Excel I use this line:

python setup.py py2exe --progid "Excel.Application"

You may need to do something similar for the db application.

Jul 19 '05 #2
Ok apparently that's not the fix. I just tried that with Python 2.4 and
the newest version of py2exe and win32all, and I can not get it to
work.

Can someone explain how to freeze Excel with the new version of py2exe?
The old way isn't working anymore. I used one of the templates
provided, but I kept getting CLSID errors, even when I provide the
typelib in the options menu in setup.

So "--progid" was removed, what replaced it?

Thanks

Jul 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Giles Brown | last post: by
reply views Thread by Tim Roberts | last post: by
1 post views Thread by David Nicolson | last post: by
4 posts views Thread by gt_mac | last post: by
2 posts views Thread by Just Me | last post: by
1 post views Thread by Mark Morss | last post: by
11 posts views Thread by Bill Davy | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.