[Tutor] Program work fine in IDLE but not once compile from Py2exe

Michel Bélanger michel.belanger at seidel.ca
Thu Feb 19 15:53:15 EST 2004


Hi all,

It may not be the right place to post this message, but I do not know 
where else to go.

I have the following function that works fine within IDLE but not  the 
exe version compile under Py2exe.
I have python 2.2.3 and Py2exe 0.5.


The error message is:

D:\1_Prog\Python23\dist\library.zip\PythonCardPrototype\debug.py:30: 
UserWarning
: PyCrust has been renamed to Py.  Use 'from wx import py'
Traceback (most recent call last):
  File "PythonCardPrototype\components\button.pyc", line 144, in _dispatch
  File "PythonCardPrototype\event.pyc", line 334, in notifyEventListeners
  File "PythonCardPrototype\dispatch.pyc", line 81, in eventOccurred
  File "XferUpdFileOnWeb.py", line 48, in on_btnStart_mouseClick
  File "XferUpdFileOnWeb.py", line 176, in getPerceptionLicense
LookupError: no codec search functions registered: can't find encoding

The corresponding code is:

def getPerceptionLicense():
    #get Perception path from registry
    keyName = "Software\\VB and VBA Program 
Settings\\Perception\\Installation"
    key = win32api.RegOpenKeyEx(win32con.HKEY_CURRENT_USER , keyName, 0, 
win32con.KEY_ALL_ACCESS)
    infoPath = win32api.RegQueryValueEx(key, "Path")
    #get license information from MSACCESS file using ADO
    conn=win32com.client.Dispatch(r'ADODB.Connection')
    filename = infoPath[0] + '\\config.per'
    # file is protected from direct reading by password
    dsn = 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=' + filename + 
';Jet OLEDB:Database Password=sorbier'
    conn.Open(dsn)
    rs = win32com.client.Dispatch(r'ADODB.Recordset')
    rs_name = 'select * from Enregistrement'
    rs.Open('['+ rs_name + ']', conn, 1, 3)
    Code = rs.Fields("Code").Value
     #***following line is causing the error message.  With IDLE it 
print a string similar to '612789'
    print Code
    return Code
    rs.MoveNext()
    rs.Close()
    conn.Close()

Regards

Michel Belanger






More information about the Tutor mailing list