I tried the package my application which has only two files, one for the GUI (wxPython) and a Library used by the GUI. Below is my setup.py code:

from distutils.core import setup
import py2exe

setup(name="U51 Converter", scripts=['convertapp.pyw'])
class Target:
    def __init__(self, **kw):
        self.__dict__.update(kw)
        # for the versioninfo resources
        self.version = "0.01.1"
        self.company_name = "NovaSteps, Inc"
        self.copyright = "Copyright (c) 2008 NovaSteps, Inc."
        self.name = "U51 Transcoder"

I ran the following command: python setup.py py2exe What I got was a buld and dist folder, but my app is not present in there. What am I doing wrong?

You need to create an instance of class Target and give it some more needed information. This is a standalone file and will run the whole thing ...

# Just save this file to the working folder
# that contains your code file.
# Then just run it ...
# It will create two subfolders called build and dist.
# The dist folder contains your .exe file, MSVCR71.dll and w9xpopen.exe
# Your .exe file contains your code, all needed modules + the Python
# interpreter as a Pythonxx.dll.
# MSVCR71.dll can be distributed, but is often already in the system32
# folder. The build folder can be deleted.

from distutils.core import setup
import py2exe
import sys

# if run without args, build executables in quiet mode
if len(sys.argv) == 1:
    sys.argv.append("py2exe")
    sys.argv.append("-q")


class Target:
    def __init__(self, **kw):
        self.__dict__.update(kw)
        # for the versioninfo resources
        self.version = "0.01.1"
        self.company_name = "NovaSteps, Inc"
        self.copyright = "Copyright (c) 2008 NovaSteps, Inc."
        self.name = "U51 Transcoder"

# create an instance of class Target
# and give it additional needed info
target = Target(
    description = "A GUI app",
    # this is your code file
    script = "convertapp.pyw",
    # this will form convertapp.exe
    dest_base = "convertapp")

setup(
    options = {"py2exe": {"compressed": 1,
                          "optimize": 2,
                          "ascii": 1,
                          "bundle_files": 1}},
    zipfile = None,
    windows = [target]
    )
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.