py2exe executable Fails

My short script, KWS.py created in Python 3.4.3, runs flawlessly in pyscripter.
The creation of the executable in py2exe version 0.9.2.2 on Window 8 is successful.

But upon running the executable it fails with this error:

Traceback (most recent call last):

File “KWS.py”, line 47, in

File “C:\Python34\lib\encodings\cp437.py”, line 19, in encode return codecs.charmap_encode(input,self.errors,encoding_map)[0]

UnicodeEncodeError: ‘charmap’ codec can’t encode characters in position 18-26: character maps to

Calling out the supporting cp437.py line errors

Lines 17, 18 and 19 from cp437.py

My Setup.py script is simple:

import py2exe

from distutils.core import setup

setup(console= [‘C:\Python34\scripts2convert\KWS.py’],

options = {‘py2exe’: {‘packages’: [‘encodings’, ‘encodings’]}},)

Assistance in the form of how to add the proper encoding decoding which appears to be available in the

KWS.py version but not the created in the KWS.exe version.

Somehow it appears py2exe is not including the proper codecs during creation of the executable.

PS

found some methonds for telling py2exe (in the Setup.py file) which codecs to include but it failed due to being obsolete.

Can you create a smallest possible sample (assuming kws.py is large) and your complete setup.py to be able to do some tests?

Werner

···

On 9/27/2015 17:36, Rudy Trujillo wrote:

My short script, KWS.py created in Python 3.4.3, runs flawlessly in pyscripter.
The creation of the executable in py2exe version 0.9.2.2 on Window 8 is successful.
But upon running the executable it fails with this error:

Traceback (most recent call last):

File "KWS.py", line 47, in <module>

File "C:\Python34\lib\encodings\cp437.py", line 19, in encode return codecs.charmap_encode(input,self.errors,encoding_map)[0]

UnicodeEncodeError: 'charmap' codec can't encode characters in position 18-26: character maps to <undefined>

Calling out the supporting cp437.py line errors

Lines 17, 18 and 19 from cp437.py

My Setup.py script is simple:

import py2exe

from distutils.core import setup

setup(console= ['C:\Python34\scripts2convert\KWS.py'],

options = {'py2exe': {'packages': ['encodings', 'encodings']}},)

Assistance in the form of how to add the proper encoding decoding which appears to be available in the

KWS.py version but not the created in the KWS.exe version.

Somehow it appears py2exe is not including the proper codecs during creation of the executable.

PS

found some methonds for telling py2exe (in the Setup.py file) which codecs to include but it failed due to being obsolete.