wx.Locale and pyinstaller?

can anyone tell me how to include the .mo files from wx.localizations.* into a pyinstaller package such that the executable will be able to correctly localize?

Thanks,

Joran

Just some more info …

···

Im totally at a loss. and this is going to take someone with some in-depth knowledge (probably of pyinstaller,moreso than anything else)

I have been 100% unsuccessful at including the c:\Python26\Lib\site-packages\wx-2.8-msw-unicode\Locale\* translation files in a pyinstaller executable … wx.Locale(locale_code) simply isnt finding the intended packages.

can someone give me a hint(or a flat out answer) on how to include the *.mo files in the spec file such that the exe can find them?

I wish i had more "I tried this … but frankly with pyinstaller I have very little idea what Im doing and just kind of sledgehammer on my .spec file (which is gross and I would not want to subject anyone here to it …)

-------------------------------------------------------d---------------------------------------------------------------------------------------
On Friday, 25 January 2013 10:29:27 UTC-8, joran wrote:

can anyone tell me how to include the .mo files from wx.localizations.* into a pyinstaller package such that the executable will be able to correctly localize?

Thanks,

Joran

This is really more of a pyinstaller question as you mention below,
and I think you would get better answers in the pyinstaller mailing
list. At any rate, though, the proper way to do something like this
is in the pyinstaller hooks for wxpython. That route is not too bad,
but will require a little mind-bending to figure out what is really
going on there.

The quick and dirty solution is to just add the locale files to the
table-of-contents that determines exactly which files pyinstaller will
pull in. In your .spec file, look for a call to EXE() (or you might
need to look at COLLECT() if you are doing a one-dir build). Any non
keyworded arguments there is just a table-of-contents list that looks
like this:

[(to,from,'DATA'),(to,from,'DATA'),....]

where "to" and "from" the destination and source of each file that you
want included. The .spec file is just a python script like any other,
so insert some code to walk the locale files in wxPython, and add them
one by one to your custom TOC list. Then throw that custom TOC list
in as an argument to EXE() or COLLECT() as appropriate. IIRC, "to" is
a relative path within your package, and "from" is obviously the full
path to the file you want to package.

···

On Fri, Jan 25, 2013 at 2:22 PM, joran <joranbeasley@gmail.com> wrote:

Just some more info ...

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Im totally at a loss. and this is going to take someone with some in-depth
knowledge (probably of pyinstaller,moreso than anything else)

I have been 100% unsuccessful at including the
c:\Python26\Lib\site-packages\wx-2.8-msw-unicode\Locale\* translation files
in a pyinstaller executable ... wx.Locale(locale_code) simply isnt finding
the intended packages.

can someone give me a hint(or a flat out answer) on how to include the *.mo
files in the spec file such that the exe can find them?

I wish i had more "I tried this ... but frankly with pyinstaller I have very
little idea what Im doing and just kind of sledgehammer on my .spec file
(which is gross and I would not want to subject anyone here to it ...)

-------------------------------------------------------d---------------------------------------------------------------------------------------
On Friday, 25 January 2013 10:29:27 UTC-8, joran wrote:

can anyone tell me how to include the .mo files from wx.localizations.*
into a pyinstaller package such that the executable will be able to
correctly localize?

Thanks,

Joran

--
--
To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com
or visit http://groups.google.com/group/wxPython-users?hl=en

--
Daniel Hyams
dhyams@gmail.com

that was actually helpful :slight_smile: I have now included the files in my installer. however wx still cant seem to find them … how can I tell wx where to look?

···

On Friday, 25 January 2013 11:38:28 UTC-8, dhyams wrote:

This is really more of a pyinstaller question as you mention below,

and I think you would get better answers in the pyinstaller mailing

list. At any rate, though, the proper way to do something like this

is in the pyinstaller hooks for wxpython. That route is not too bad,

but will require a little mind-bending to figure out what is really

going on there.

The quick and dirty solution is to just add the locale files to the

table-of-contents that determines exactly which files pyinstaller will

pull in. In your .spec file, look for a call to EXE() (or you might

need to look at COLLECT() if you are doing a one-dir build). Any non

keyworded arguments there is just a table-of-contents list that looks

like this:

[(to,from,‘DATA’),(to,from,‘DATA’),…]

where “to” and “from” the destination and source of each file that you

want included. The .spec file is just a python script like any other,

so insert some code to walk the locale files in wxPython, and add them

one by one to your custom TOC list. Then throw that custom TOC list

in as an argument to EXE() or COLLECT() as appropriate. IIRC, “to” is

a relative path within your package, and “from” is obviously the full

path to the file you want to package.

On Fri, Jan 25, 2013 at 2:22 PM, joran joranb...@gmail.com wrote:

Just some more info …


Im totally at a loss. and this is going to take someone with some in-depth

knowledge (probably of pyinstaller,moreso than anything else)

I have been 100% unsuccessful at including the

c:\Python26\Lib\site-packages\wx-2.8-msw-unicode\Locale* translation files

in a pyinstaller executable … wx.Locale(locale_code) simply isnt finding

the intended packages.

can someone give me a hint(or a flat out answer) on how to include the *.mo

files in the spec file such that the exe can find them?

I wish i had more "I tried this … but frankly with pyinstaller I have very

little idea what Im doing and just kind of sledgehammer on my .spec file

(which is gross and I would not want to subject anyone here to it …)

-------------------------------------------------------d---------------------------------------------------------------------------------------

On Friday, 25 January 2013 10:29:27 UTC-8, joran wrote:

can anyone tell me how to include the .mo files from wx.localizations.*

into a pyinstaller package such that the executable will be able to

correctly localize?

Thanks,

Joran

To unsubscribe, send email to wxPython-user...@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en


Daniel Hyams

dhy...@gmail.com

joran wrote:

that was actually helpful :slight_smile: I have now included the files in my
installer. however wx still cant seem to find them ... how can I tell wx
where to look?

When wx is imported it does the following code. You can do something similar of your locale folder is located somewhere that the following won't find it:

···

#----------------------------------------------------------------------------
# Add the directory where the wxWidgets catalogs were installed
# to the default catalog path, if they were put in the package dir.
import os
_localedir = os.path.join(os.path.dirname(__file__), "locale")
if os.path.exists(_localedir):
     Locale.AddCatalogLookupPathPrefix(_localedir)
del os

#----------------------------------------------------------------------------

--
Robin Dunn
Software Craftsman