[wxPython-users] Two exe's in one py2exe dist?

Jorgen Bodde jorgen.maillist at gmail.com
Mon Feb 11 03:13:21 PST 2008


Hi Jean Michel,

Doing this requires a lot of overhead, and it is difficult if both
exe's have to share a common data structure. If you convert console.py
in a console exe, the dist dir is 10Mb big to start with. Then if I
convert the gui.py in a exe I get another 25 Mb. So if the user
installs both versions it will be 35 Mb worth of data on his PC. Which
is a bit too much..

I did find a very elegant method though. In the setup script, simply
define both a windows parameter and a console parameter. py2exe
converts both start scripts to an exe, and the library.zip will
contain all the files needed by both scripts. It couldn't be more
elegant then that ;-)

setup( windows = [ { "script": "cvlgui.pyw",
                     "icon_resources": [(1, "cvlgui.ico")],
                     "other_resources": [(24,1,manifest)] } ]
      ,data_files=["dll\\msvcp71.dll"],
      console = [ "cvl.py" ]
    )

Regards,
- Jorgen

On Feb 10, 2008 5:21 PM, jmf <jfauth at bluewin.ch> wrote:
> Hi all,
>
> Surprisingly, this quite easy to do. I have done this several times on my
> w2k box.
>
> The trick:
> py2exe will create a bootstrap (exe) from the application scripts. It
> "transforms" the *main* script and only the main into the exe and sets
> all the application dependencies (Python scripts) in the library.zip. The
> library.zip contains everything, except the main/start script.
>
> My recipe:
> For a given application called app, create two start scripts, eg, one called
> appgui.py (appgui.pyw) and the other called appconsole.py.
>
> For each version, appgui/appconsole, create a setup for py2exe and build
> the dist in different directories.
>
> One this is done, one has
>
> in ..\distgui : appgui.exe, library.zip, wx*.dll, python.dll,icon, help files...
> Library.zip hold everything but appgui.py.
>
> in ..\distconsole : appconsole.exe, library.zip, ....
> Library.zip hold everything but appconsole.py.
>
> Move appconsole.exe into ..\distgui.
> Done!
>
> Jean-Michel Fauth, Switzerland
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wxPython-users-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail: wxPython-users-help at lists.wxwidgets.org
>
>




More information about the wxpython-users mailing list