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

ulysses ulysses_dm at yahoo.com.cn
Wed Nov 12 04:10:33 EST 2003


hi.

I use python 23,py2exe 0.4.3 ,wxpython do my py app in win32.
I use gettext to support multi languages. I build a small fuction for load 
language at top of main module.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def setLan(lan):
    import gettext
    langs = gettext.GNUTranslations(open (join ( localPath,
                                               ( "lan/"+lan+".mo" ) )
                                          ) )
    langs.install()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Above run normally in debug mode, when I compile to exe by py2exe.
the exe can't run, no error raised, I can see exe in task manager.
but after few seconds , exe disappear automaticlly.

If I remove the function setLan, EXE can show main GUI.
But the function I has used it in another app,python22 ,wxpython.

So I use other way of show multi language. 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def setLan():
    t = gettext.translation("tbt", os.path.join(dir,"locale\\"), 
    languages=['en'])
    t.install()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

situation same as before, can run in script mode, exe can't show.
Remove this function, program ok. 

I don't what happen , I have test many many times. 
Somebody help me :(

ulysses




More information about the Python-list mailing list