encoding error

ryan ambiod at sbcglobal.net
Mon Jul 21 22:15:57 CEST 2003

1) i have a function that i made in one of my program's modules named
"input_box.py" that uses unicode:

def get_key():
    while 1:
        event = pygame.event.poll()
        if event.type == KEYDOWN:
            ev_unicode = event.unicode
            if type(ev_unicode) == types.UnicodeType:
                if ev_unicode == '':
                    ev_unicode = 0
                    ev_unicode = ord(ev_unicode)
            value = unichr(ev_unicode).encode('latin1')
            return (event.key, value)
2) i use py2exe to compile it with the option for encodings, like the docs

python setup.py py2exe --packages encodings
3) I still get the error:
Traceback (most recent call last):
  File "<string>", line 110, in ?
  File "<string>", line 82, in main
  File "handle_keyboard.pyc", line 113, in handle_keyboard
  File "open_url.pyc", line 126, in open_url
  File "input_box.pyc", line 53, in ask
  File "input_box.pyc", line 21, in get_key
LookupError: no codec search functions registered: can't find encoding
4) Aren't I only supposed to get the above error "LookupError: no codec
search functions registered: can't find encoding" if i did NOT compile with
"--packages encodings"?
5) Why am i still getting this error when i run the exe? I do not get it
when i just run the source

More information about the Python-list mailing list