473,692 Members | 2,388 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Problem:

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

conn = win32com.client .gencache.Ensur eDispatch('ADOD B.Connection')
conn.Open("Prov ider='SQLOLEDB' ;Data Source='.';Init ial
Catalog='mydata base';User ID='user';Passw ord='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\clien t\gencache.pyc" , line 540, in EnsureDispatch
File "win32com\clien t\CLSIDToClass. pyc", line 50, in GetClass
KeyError: '{00000550-0000-0010-8000-00AA006D2EA4}'
Solution:

Use a registered typelib that has ADODB.Connectio n functionality :)

Any suggestions...

Jul 19 '05 #1
2 4132
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.Applicat ion"

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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
9104
by: Giles Brown | last post by:
I'm feeling quite dumb this morning. I'm trying to build a COM server DLL using py2exe and it ain't working. Here's what ain't working... setup_dll.py based on py2exe sample: """from distutils.core import setup import py2exe
0
1249
by: Tim Roberts | last post by:
It looks to me like the handling of the currency type in an ADODB connecction from Python is broken. Currency data in an Access database is stored as a 64-bit integer, scaled by 10000. In an ADODB recordset, this is returned as a 2-tuple, where the second element is the currency value, but the value is stored as a normal integer, not a lont integer. Thus, it fails for values greater than about $214,700 (2**32 / 10**4). Here is an...
1
10528
by: David Nicolson | last post by:
Hi, I have been successfully using iTunes' COM interface with Python using either of the following lines successfully: iTunes = win32com.client.gencache.EnsureDispatch("iTunes.Application") iTunes = win32com.client.Dispatch("iTunes.Application") The only problem is that it will launch iTunes if it is not running by instantiating the object here. There are some reasons why I have
4
6321
by: gt_mac | last post by:
In trying to use the adodb module, I have had good success. However I need to access a database with a username and password at this time. And cannot find a way to do it without using a ODBC or other older techniques. Can someone help me with this, below is the code I am currently attempting to use. I am just not sure where to place the username and password information or how to pull this from a text file. import mx.ODBC.Windows import...
9
17023
by: mcbill20 | last post by:
Hello all. I just installed Oracle 10g developer tools on a machine running XP Pro and Office XP. Before this I had just the Oracle 9 client installed. I the previous configuration, I was able to access any of the Oracle tables on another machine but now I am having problems. Unfortunately, I don't remember the correct syntax for the ODBC connect string and I am hoping that is my whole problem. I am trying to connect to an Oracle 9...
0
1716
by: dmckenna | last post by:
I've been tasked to upgrade an old system and there's many different versions of VB code that uses MDAC to talk to MSSql. Do you know what the difference is between the two code versions? Is there problems with re-opening connections all the time? Version 1 of the program is:
2
1099
by: Just Me | last post by:
Has anyone had problems connection to this server. I had problems getting connected to it on and off for a couple of days now.
1
2745
by: Mark Morss | last post by:
Is this the place to ask a win32com.client question? I am a unix person trying to run on windows, so I have little familiarity with this module. I have this code: import win32com.client """An Access connection""" def connect(data_source, user, pwd, mdw): connAccess = win32com.client.Dispatch(r'ADODB.Connection')
11
7714
by: Bill Davy | last post by:
I am trying to edit Contacts in Outlook. This is so I can transfer numbers from my address book which is an Excel spreadsheet to my mobile phone. I came across the following snippet of code which enabled me to the contacts at least list. I had to root around to discover CdoDefaultFolderContacts (though it was guessable; how could I enumerate win32com.client.constants?). I now want to work through the Contacts in Outlook patching in...
0
8611
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8547
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9090
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
6462
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5822
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4329
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2983
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2242
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1962
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.