can't run py app after compile to exe by py2exe , gettext

Thomas Heller theller at python.net
Thu Nov 13 05:45:54 EST 2003


ulysses_dm at yahoo.com.cn (ulysses) writes:

> I do a small test app for this. Still can't run.

> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> full source package 
> please download from
>
> http://211.90.187.42/ourbt/gettexttest.rar
>
> you test in in your computer. Thanks.

I tried it, and it seems you have to make sure that the en.mo file is in
the same directory as the exe, and you have to manually include the
'encodings' package - there's a command line switch for that.

To help to find these types of problems, it's always useful to build the
exe as a console version first with the --console command line flag to
py2exe.  There's no way for the --windows exe to notify you of the
tracebacks.

And if you want to try the 0.5.0 version of py2exe (which requires
Python 2.3), here is the setup script you would use:

"""
from distutils.core import setup
import py2exe

setup(name='testgettext',
      options = {"py2exe": {"packages": ["encodings"]}},
      windows = ['main.py'],
      data_files = [("", ["en.mo"])],
      )
"""

The latest py2exe 0.5.0 creates windows programs in such a way that
tracebacks are routed into a log file (that would be 'main.exe.log' in
the above case), and even displayes a message box when the program ends
pointing the user to the logfile.

Thomas




More information about the Python-list mailing list