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

L

list.repository

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...
 
M

Mudcat

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.
 
M

Mudcat

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top