Perhaps you didn't tell py2exe to include the encodings package?
Oops, you are right. I confused codecs and encodings. Problem fixed.
Anyway, thanks for wx.GetDefaultPyEncoding() code.
from py2exe doc:
You can do this by adding a line
options = {"py2exe": {"packages": ["encodings"]}},
to your setup.py file.
Jean-Michel Fauth, Switzerland