py2exe and urllib(2) errors

Larry Bates lbates at swamisoft.com
Tue Mar 16 00:06:29 CET 2004


(From the py2exe homepage:
http://starship.python.net/crew/theller/py2exe/)
..if your exe-file reports errors like LookupError: no codec search
functions registered: can't find encoding or LookupError: unknown encoding,
you should advise py2exe to include this package with the '--packages
encodings' command line option.

Google turns up information very quickly.

Larry Bates


"Mike Zupan" <mike at zcentric.com> wrote in message
news:mailman.6.1079387105.742.python-list at python.org...
I had some problems with urllib and py2exe under pyton2.3. I works fine
until i try to use the exe file.

Here is the error

Error: 1
LookupError Exception in Tk callback
  Function: <bound method MainWindow.selectDir of <__main__.MainWindow
instance
at 0x00DF4058>> (type: <type 'instancemethod'>)
  Args: ()
Traceback (innermost last):
  File "Pmw.pyc", line 1784, in __call__
    None
  File "<string>", line 270, in selectDir
    None
  File "<string>", line 361, in grabAlbumDirs
    None
  File "<string>", line 431, in addAlbumData
    None
  File "<string>", line 469, in grabImage
    None
  File "urllib2.pyc", line 129, in urlopen
    None
  File "urllib2.pyc", line 326, in open
    None
  File "urllib2.pyc", line 306, in _call_chain
    None
  File "urllib2.pyc", line 901, in http_open
    None
  File "urllib2.pyc", line 884, in do_open
    None
  File "httplib.pyc", line 712, in endheaders
    None
  File "httplib.pyc", line 597, in _send_output
    None
  File "httplib.pyc", line 564, in send
    None
  File "httplib.pyc", line 532, in connect
    None
LookupError: no codec search functions registered: can't find encoding


Here is the section of code that produces the error

urllib.urlretrieve(imageURL, saveFile)

imageURL and saveFile are correct


Here is my setup.py file

# setup.py
from distutils.core import setup

import py2exe

setup(
    scripts=["art.py"]
)


and here is my batch file

c:\python23\python setup.py py2exe -pPIL --packages=encodings


Thanks
Mike







More information about the Python-list mailing list