Py2exe

Larry Bates larry.bates at websafe.com
Tue Feb 28 16:52:30 EST 2006


D wrote:
> Jay - what I'm not sure of is the syntax to use.  I have downloaded and
> installed py2exe.
> 

First a question:

Have you written the server program as a windows service?  You can't
just run something as a service, it has to be written to be a service.

Your setup files will look something like the ones below.

Client:

from distutils.core import setup
import py2exe
setup(name="client", zipfile=None,
      windows=[{"script":"client.py",
                "icon_resources":[(1,"client.ico")]}],
      options={"py2exe": {"compressed": 1,
                          "optimize": 2,
                          "bundle_files":1}}
     )

Obviously the program here was called client.py.  You will
need an icon to supply to icon_resources.  This creates a
single .EXE file from as much as py2exe can possible put
into it.

Server:

from distutils.core import setup
import py2exe
setup(service=[script:"server.py"], zipfile=None,
      options={"py2exe":{"compressed": 1,
                         "optimize": 2,
                         "bundle_files":1}}
      )


Of course replace 'server' with the name of your program.

These are merely EXAMPLES.  Your specific needs might be
different depending on specifics of your program.

Hope it helps.

Larry Bates



More information about the Python-list mailing list