[Pygame] making an exe for pygame

[Pygame] making an exe for pygame

Postby metulburr » Tue Jan 14, 2014 7:22 pm

I grabbed pygame2exe script from pygame.org and modified best of my ability to what i know.:

pygame2exe.py
Code: Select all

# This will create a dist directory containing the executable file, all the data
# directories. All Libraries will be bundled in executable file.
#
# Run the build process by entering 'pygame2exe.py' or
# 'python pygame2exe.py' in a console prompt.
#
# To build exe, python, pygame, and py2exe have to be installed. After
# building exe none of this libraries are needed.
#Please Note have a backup file in a different directory as if it crashes you
#will loose it all!(I lost 6 months of work because I did not do this)
 
 
try:
    from distutils.core import setup
    import py2exe, pygame
    from modulefinder import Module
    import glob, fnmatch
    import sys, os, shutil
    import operator
except ImportError, message:
    raise SystemExit,  "Unable to load module. %s" % message
 
#hack which fixes the pygame mixer and pygame font
origIsSystemDLL = py2exe.build_exe.isSystemDLL # save the orginal before we edit it
def isSystemDLL(pathname):
    # checks if the freetype and ogg dll files are being included
    if os.path.basename(pathname).lower() in ("libfreetype-6.dll", "libogg-0.dll","sdl_ttf.dll"): # "sdl_ttf.dll" added by arit.
            return 0
    return origIsSystemDLL(pathname) # return the orginal function
py2exe.build_exe.isSystemDLL = isSystemDLL # override the default function with this one
 
class pygame2exe(py2exe.build_exe.py2exe): #This hack make sure that pygame default font is copied: no need to modify code for specifying default font
    def copy_extensions(self, extensions):
        #Get pygame default font
        pygamedir = os.path.split(pygame.base.__file__)[0]
        pygame_default_font = os.path.join(pygamedir, pygame.font.get_default_font())
 
        #Add font to list of extension to be copied
        extensions.append(Module("pygame.font", pygame_default_font))
        py2exe.build_exe.py2exe.copy_extensions(self, extensions)
 
class BuildExe:
    def __init__(self):
        #Name of starting .py
        self.script = "game.py"
 
        #Name of program
        self.project_name = "Pong"
 
        #Project url
        self.project_url = "about:none"
 
        #Version of program
        self.project_version = "0.1"
 
        #License of the program
        self.license = "None"
 
        #Auhor of program
        self.author_name = "metulburr"
        self.author_email = "micahpage911@yahoo.com"
        self.copyright = "None"
 
        #Description
        self.project_description = "Pong game written in Python/Pygame"
 
        #Icon file (None will use pygame default icon)
        self.icon_file = None
 
        #Extra files/dirs copied to game
        self.extra_datas = []
 
        #Extra/excludes python modules
        self.extra_modules = []
        self.exclude_modules = []
       
        #DLL Excludes
        self.exclude_dll = ['']
        #python scripts (strings) to be included, seperated by a comma
        self.extra_scripts = []
 
        #Zip file name (None will bundle files in exe instead of zip file)
        self.zipfile_name = None
 
        #Dist directory
        self.dist_dir ='dist'
 
    ## Code from DistUtils tutorial at http://wiki.python.org/moin/Distutils/Tutorial
    ## Originally borrowed from wxPython's setup and config files
    def opj(self, *args):
        path = os.path.join(*args)
        return os.path.normpath(path)
 
    def find_data_files(self, srcdir, *wildcards, **kw):
        # get a list of all files under the srcdir matching wildcards,
        # returned in a format to be used for install_data
        def walk_helper(arg, dirname, files):
            if '.svn' in dirname:
                return
            names = []
            lst, wildcards = arg
            for wc in wildcards:
                wc_name = self.opj(dirname, wc)
                for f in files:
                    filename = self.opj(dirname, f)
 
                    if fnmatch.fnmatch(filename, wc_name) and not os.path.isdir(filename):
                        names.append(filename)
            if names:
                lst.append( (dirname, names ) )
 
        file_list = []
        recursive = kw.get('recursive', True)
        if recursive:
            os.path.walk(srcdir, walk_helper, (file_list, wildcards))
        else:
            walk_helper((file_list, wildcards),
                        srcdir,
                        [os.path.basename(f) for f in glob.glob(self.opj(srcdir, '*'))])
        return file_list
 
    def run(self):
        if os.path.isdir(self.dist_dir): #Erase previous destination dir
            shutil.rmtree(self.dist_dir)
       
        #Use the default pygame icon, if none given
        if self.icon_file == None:
            path = os.path.split(pygame.__file__)[0]
            self.icon_file = os.path.join(path, 'pygame.ico')
 
        #List all data files to add
        extra_datas = []
        for data in self.extra_datas:
            if os.path.isdir(data):
                extra_datas.extend(self.find_data_files(data, '*'))
            else:
                extra_datas.append(('.', [data]))
       
        setup(
            cmdclass = {'py2exe': pygame2exe},
            version = self.project_version,
            description = self.project_description,
            name = self.project_name,
            url = self.project_url,
            author = self.author_name,
            author_email = self.author_email,
            license = self.license,
 
            # targets to build
            windows = [{
                'script': self.script,
                'icon_resources': [(0, self.icon_file)],
                'copyright': self.copyright
            }],
            options = {'py2exe': {'optimize': 2, 'bundle_files': 1, 'compressed': True, \
                                  'excludes': self.exclude_modules, 'packages': self.extra_modules, \
                                  'dll_excludes': self.exclude_dll,
                                  'includes': self.extra_scripts} },
            zipfile = self.zipfile_name,
            data_files = extra_datas,
            dist_dir = self.dist_dir
            )
       
        if os.path.isdir('build'): #Clean up build dir
            shutil.rmtree('build')
 
if __name__ == '__main__':
    if operator.lt(len(sys.argv), 2):
        sys.argv.append('py2exe')
    BuildExe().run() #Run generation
    raw_input("Press any key to continue") #Pause to let user see that things ends


then input that with my startup script for pygame and executed it. the logfile for that is:
Code: Select all
C:\Users\micah_000\Downloads\pong-master>python pygame2exe.py
running py2exe
creating C:\Users\micah_000\Downloads\pong-master\build
creating C:\Users\micah_000\Downloads\pong-master\build\bdist.win32
creating C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe
creating C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\collect-2.7
creating C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\bundle-2.7
creating C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\temp
creating C:\Users\micah_000\Downloads\pong-master\dist
*** searching for required modules ***
*** parsing results ***
*** finding dlls needed ***
*** create binaries ***
*** byte compile python files ***
writing byte-compilation script 'c:\users\micah_~1\appdata\local\temp\tmp4ftukm.py'
C:\Python27\python.exe -OO c:\users\micah_~1\appdata\local\temp\tmp4ftukm.py
byte-compiling C:\Python27\lib\Queue.py to Queue.pyo
byte-compiling C:\Python27\lib\StringIO.py to StringIO.pyo
byte-compiling C:\Python27\lib\UserDict.py to UserDict.pyo
byte-compiling C:\Python27\lib\__future__.py to __future__.pyo
byte-compiling C:\Python27\lib\_abcoll.py to _abcoll.pyo
byte-compiling C:\Python27\lib\_osx_support.py to _osx_support.pyo
byte-compiling C:\Python27\lib\_strptime.py to _strptime.pyo
byte-compiling C:\Python27\lib\_threading_local.py to _threading_local.pyo
byte-compiling C:\Python27\lib\_weakrefset.py to _weakrefset.pyo
byte-compiling C:\Python27\lib\abc.py to abc.pyo
byte-compiling C:\Python27\lib\argparse.py to argparse.pyo
byte-compiling C:\Python27\lib\atexit.py to atexit.pyo
byte-compiling C:\Python27\lib\base64.py to base64.pyo
byte-compiling C:\Python27\lib\bdb.py to bdb.pyo
byte-compiling C:\Python27\lib\bisect.py to bisect.pyo
byte-compiling C:\Python27\lib\calendar.py to calendar.pyo
byte-compiling C:\Python27\lib\cmd.py to cmd.pyo
byte-compiling C:\Python27\lib\codecs.py to codecs.pyo
byte-compiling C:\Python27\lib\collections.py to collections.pyo
byte-compiling C:\Python27\lib\contextlib.py to contextlib.pyo
byte-compiling C:\Python27\lib\copy.py to copy.pyo
byte-compiling C:\Python27\lib\copy_reg.py to copy_reg.pyo
byte-compiling C:\Python27\lib\ctypes\__init__.py to ctypes\__init__.pyo
byte-compiling C:\Python27\lib\ctypes\_endian.py to ctypes\_endian.pyo
byte-compiling C:\Python27\lib\difflib.py to difflib.pyo
byte-compiling C:\Python27\lib\dis.py to dis.pyo
byte-compiling C:\Python27\lib\distutils\__init__.py to distutils\__init__.pyo
byte-compiling C:\Python27\lib\distutils\errors.py to distutils\errors.pyo
byte-compiling C:\Python27\lib\distutils\log.py to distutils\log.pyo
byte-compiling C:\Python27\lib\distutils\spawn.py to distutils\spawn.pyo
byte-compiling C:\Python27\lib\distutils\sysconfig.py to distutils\sysconfig.pyo
byte-compiling C:\Python27\lib\distutils\text_file.py to distutils\text_file.pyo
byte-compiling C:\Python27\lib\doctest.py to doctest.pyo
byte-compiling C:\Python27\lib\dummy_thread.py to dummy_thread.pyo
byte-compiling C:\Python27\lib\dummy_threading.py to dummy_threading.pyo
byte-compiling C:\Python27\lib\email\__init__.py to email\__init__.pyo
byte-compiling C:\Python27\lib\email\_parseaddr.py to email\_parseaddr.pyo
byte-compiling C:\Python27\lib\email\base64mime.py to email\base64mime.pyo
byte-compiling C:\Python27\lib\email\charset.py to email\charset.pyo
byte-compiling C:\Python27\lib\email\encoders.py to email\encoders.pyo
byte-compiling C:\Python27\lib\email\errors.py to email\errors.pyo
byte-compiling C:\Python27\lib\email\feedparser.py to email\feedparser.pyo
byte-compiling C:\Python27\lib\email\generator.py to email\generator.pyo
byte-compiling C:\Python27\lib\email\header.py to email\header.pyo
byte-compiling C:\Python27\lib\email\iterators.py to email\iterators.pyo
byte-compiling C:\Python27\lib\email\message.py to email\message.pyo
byte-compiling C:\Python27\lib\email\mime\__init__.py to email\mime\__init__.pyo
byte-compiling C:\Python27\lib\email\parser.py to email\parser.pyo
byte-compiling C:\Python27\lib\email\quoprimime.py to email\quoprimime.pyo
byte-compiling C:\Python27\lib\email\utils.py to email\utils.pyo
byte-compiling C:\Python27\lib\encodings\__init__.py to encodings\__init__.pyo
byte-compiling C:\Python27\lib\encodings\aliases.py to encodings\aliases.pyo
byte-compiling C:\Python27\lib\encodings\ascii.py to encodings\ascii.pyo
byte-compiling C:\Python27\lib\encodings\base64_codec.py to encodings\base64_codec.pyo
byte-compiling C:\Python27\lib\encodings\big5.py to encodings\big5.pyo
byte-compiling C:\Python27\lib\encodings\big5hkscs.py to encodings\big5hkscs.pyo
byte-compiling C:\Python27\lib\encodings\bz2_codec.py to encodings\bz2_codec.pyo
byte-compiling C:\Python27\lib\encodings\charmap.py to encodings\charmap.pyo
byte-compiling C:\Python27\lib\encodings\cp037.py to encodings\cp037.pyo
byte-compiling C:\Python27\lib\encodings\cp1006.py to encodings\cp1006.pyo
byte-compiling C:\Python27\lib\encodings\cp1026.py to encodings\cp1026.pyo
byte-compiling C:\Python27\lib\encodings\cp1140.py to encodings\cp1140.pyo
byte-compiling C:\Python27\lib\encodings\cp1250.py to encodings\cp1250.pyo
byte-compiling C:\Python27\lib\encodings\cp1251.py to encodings\cp1251.pyo
byte-compiling C:\Python27\lib\encodings\cp1252.py to encodings\cp1252.pyo
byte-compiling C:\Python27\lib\encodings\cp1253.py to encodings\cp1253.pyo
byte-compiling C:\Python27\lib\encodings\cp1254.py to encodings\cp1254.pyo
byte-compiling C:\Python27\lib\encodings\cp1255.py to encodings\cp1255.pyo
byte-compiling C:\Python27\lib\encodings\cp1256.py to encodings\cp1256.pyo
byte-compiling C:\Python27\lib\encodings\cp1257.py to encodings\cp1257.pyo
byte-compiling C:\Python27\lib\encodings\cp1258.py to encodings\cp1258.pyo
byte-compiling C:\Python27\lib\encodings\cp424.py to encodings\cp424.pyo
byte-compiling C:\Python27\lib\encodings\cp437.py to encodings\cp437.pyo
byte-compiling C:\Python27\lib\encodings\cp500.py to encodings\cp500.pyo
byte-compiling C:\Python27\lib\encodings\cp720.py to encodings\cp720.pyo
byte-compiling C:\Python27\lib\encodings\cp737.py to encodings\cp737.pyo
byte-compiling C:\Python27\lib\encodings\cp775.py to encodings\cp775.pyo
byte-compiling C:\Python27\lib\encodings\cp850.py to encodings\cp850.pyo
byte-compiling C:\Python27\lib\encodings\cp852.py to encodings\cp852.pyo
byte-compiling C:\Python27\lib\encodings\cp855.py to encodings\cp855.pyo
byte-compiling C:\Python27\lib\encodings\cp856.py to encodings\cp856.pyo
byte-compiling C:\Python27\lib\encodings\cp857.py to encodings\cp857.pyo
byte-compiling C:\Python27\lib\encodings\cp858.py to encodings\cp858.pyo
byte-compiling C:\Python27\lib\encodings\cp860.py to encodings\cp860.pyo
byte-compiling C:\Python27\lib\encodings\cp861.py to encodings\cp861.pyo
byte-compiling C:\Python27\lib\encodings\cp862.py to encodings\cp862.pyo
byte-compiling C:\Python27\lib\encodings\cp863.py to encodings\cp863.pyo
byte-compiling C:\Python27\lib\encodings\cp864.py to encodings\cp864.pyo
byte-compiling C:\Python27\lib\encodings\cp865.py to encodings\cp865.pyo
byte-compiling C:\Python27\lib\encodings\cp866.py to encodings\cp866.pyo
byte-compiling C:\Python27\lib\encodings\cp869.py to encodings\cp869.pyo
byte-compiling C:\Python27\lib\encodings\cp874.py to encodings\cp874.pyo
byte-compiling C:\Python27\lib\encodings\cp875.py to encodings\cp875.pyo
byte-compiling C:\Python27\lib\encodings\cp932.py to encodings\cp932.pyo
byte-compiling C:\Python27\lib\encodings\cp949.py to encodings\cp949.pyo
byte-compiling C:\Python27\lib\encodings\cp950.py to encodings\cp950.pyo
byte-compiling C:\Python27\lib\encodings\euc_jis_2004.py to encodings\euc_jis_2004.pyo
byte-compiling C:\Python27\lib\encodings\euc_jisx0213.py to encodings\euc_jisx0213.pyo
byte-compiling C:\Python27\lib\encodings\euc_jp.py to encodings\euc_jp.pyo
byte-compiling C:\Python27\lib\encodings\euc_kr.py to encodings\euc_kr.pyo
byte-compiling C:\Python27\lib\encodings\gb18030.py to encodings\gb18030.pyo
byte-compiling C:\Python27\lib\encodings\gb2312.py to encodings\gb2312.pyo
byte-compiling C:\Python27\lib\encodings\gbk.py to encodings\gbk.pyo
byte-compiling C:\Python27\lib\encodings\hex_codec.py to encodings\hex_codec.pyo
byte-compiling C:\Python27\lib\encodings\hp_roman8.py to encodings\hp_roman8.pyo
byte-compiling C:\Python27\lib\encodings\hz.py to encodings\hz.pyo
byte-compiling C:\Python27\lib\encodings\idna.py to encodings\idna.pyo
byte-compiling C:\Python27\lib\encodings\iso2022_jp.py to encodings\iso2022_jp.pyo
byte-compiling C:\Python27\lib\encodings\iso2022_jp_1.py to encodings\iso2022_jp_1.pyo
byte-compiling C:\Python27\lib\encodings\iso2022_jp_2.py to encodings\iso2022_jp_2.pyo
byte-compiling C:\Python27\lib\encodings\iso2022_jp_2004.py to encodings\iso2022_jp_2004.pyo
byte-compiling C:\Python27\lib\encodings\iso2022_jp_3.py to encodings\iso2022_jp_3.pyo
byte-compiling C:\Python27\lib\encodings\iso2022_jp_ext.py to encodings\iso2022_jp_ext.pyo
byte-compiling C:\Python27\lib\encodings\iso2022_kr.py to encodings\iso2022_kr.pyo
byte-compiling C:\Python27\lib\encodings\iso8859_1.py to encodings\iso8859_1.pyo
byte-compiling C:\Python27\lib\encodings\iso8859_10.py to encodings\iso8859_10.pyo
byte-compiling C:\Python27\lib\encodings\iso8859_11.py to encodings\iso8859_11.pyo
byte-compiling C:\Python27\lib\encodings\iso8859_13.py to encodings\iso8859_13.pyo
byte-compiling C:\Python27\lib\encodings\iso8859_14.py to encodings\iso8859_14.pyo
byte-compiling C:\Python27\lib\encodings\iso8859_15.py to encodings\iso8859_15.pyo
byte-compiling C:\Python27\lib\encodings\iso8859_16.py to encodings\iso8859_16.pyo
byte-compiling C:\Python27\lib\encodings\iso8859_2.py to encodings\iso8859_2.pyo
byte-compiling C:\Python27\lib\encodings\iso8859_3.py to encodings\iso8859_3.pyo
byte-compiling C:\Python27\lib\encodings\iso8859_4.py to encodings\iso8859_4.pyo
byte-compiling C:\Python27\lib\encodings\iso8859_5.py to encodings\iso8859_5.pyo
byte-compiling C:\Python27\lib\encodings\iso8859_6.py to encodings\iso8859_6.pyo
byte-compiling C:\Python27\lib\encodings\iso8859_7.py to encodings\iso8859_7.pyo
byte-compiling C:\Python27\lib\encodings\iso8859_8.py to encodings\iso8859_8.pyo
byte-compiling C:\Python27\lib\encodings\iso8859_9.py to encodings\iso8859_9.pyo
byte-compiling C:\Python27\lib\encodings\johab.py to encodings\johab.pyo
byte-compiling C:\Python27\lib\encodings\koi8_r.py to encodings\koi8_r.pyo
byte-compiling C:\Python27\lib\encodings\koi8_u.py to encodings\koi8_u.pyo
byte-compiling C:\Python27\lib\encodings\latin_1.py to encodings\latin_1.pyo
byte-compiling C:\Python27\lib\encodings\mac_arabic.py to encodings\mac_arabic.pyo
byte-compiling C:\Python27\lib\encodings\mac_centeuro.py to encodings\mac_centeuro.pyo
byte-compiling C:\Python27\lib\encodings\mac_croatian.py to encodings\mac_croatian.pyo
byte-compiling C:\Python27\lib\encodings\mac_cyrillic.py to encodings\mac_cyrillic.pyo
byte-compiling C:\Python27\lib\encodings\mac_farsi.py to encodings\mac_farsi.pyo
byte-compiling C:\Python27\lib\encodings\mac_greek.py to encodings\mac_greek.pyo
byte-compiling C:\Python27\lib\encodings\mac_iceland.py to encodings\mac_iceland.pyo
byte-compiling C:\Python27\lib\encodings\mac_latin2.py to encodings\mac_latin2.pyo
byte-compiling C:\Python27\lib\encodings\mac_roman.py to encodings\mac_roman.pyo
byte-compiling C:\Python27\lib\encodings\mac_romanian.py to encodings\mac_romanian.pyo
byte-compiling C:\Python27\lib\encodings\mac_turkish.py to encodings\mac_turkish.pyo
byte-compiling C:\Python27\lib\encodings\mbcs.py to encodings\mbcs.pyo
byte-compiling C:\Python27\lib\encodings\palmos.py to encodings\palmos.pyo
byte-compiling C:\Python27\lib\encodings\ptcp154.py to encodings\ptcp154.pyo
byte-compiling C:\Python27\lib\encodings\punycode.py to encodings\punycode.pyo
byte-compiling C:\Python27\lib\encodings\quopri_codec.py to encodings\quopri_codec.pyo
byte-compiling C:\Python27\lib\encodings\raw_unicode_escape.py to encodings\raw_unicode_escape.pyo
byte-compiling C:\Python27\lib\encodings\rot_13.py to encodings\rot_13.pyo
byte-compiling C:\Python27\lib\encodings\shift_jis.py to encodings\shift_jis.pyo
byte-compiling C:\Python27\lib\encodings\shift_jis_2004.py to encodings\shift_jis_2004.pyo
byte-compiling C:\Python27\lib\encodings\shift_jisx0213.py to encodings\shift_jisx0213.pyo
byte-compiling C:\Python27\lib\encodings\string_escape.py to encodings\string_escape.pyo
byte-compiling C:\Python27\lib\encodings\tis_620.py to encodings\tis_620.pyo
byte-compiling C:\Python27\lib\encodings\undefined.py to encodings\undefined.pyo
byte-compiling C:\Python27\lib\encodings\unicode_escape.py to encodings\unicode_escape.pyo
byte-compiling C:\Python27\lib\encodings\unicode_internal.py to encodings\unicode_internal.pyo
byte-compiling C:\Python27\lib\encodings\utf_16.py to encodings\utf_16.pyo
byte-compiling C:\Python27\lib\encodings\utf_16_be.py to encodings\utf_16_be.pyo
byte-compiling C:\Python27\lib\encodings\utf_16_le.py to encodings\utf_16_le.pyo
byte-compiling C:\Python27\lib\encodings\utf_32.py to encodings\utf_32.pyo
byte-compiling C:\Python27\lib\encodings\utf_32_be.py to encodings\utf_32_be.pyo
byte-compiling C:\Python27\lib\encodings\utf_32_le.py to encodings\utf_32_le.pyo
byte-compiling C:\Python27\lib\encodings\utf_7.py to encodings\utf_7.pyo
byte-compiling C:\Python27\lib\encodings\utf_8.py to encodings\utf_8.pyo
byte-compiling C:\Python27\lib\encodings\utf_8_sig.py to encodings\utf_8_sig.pyo
byte-compiling C:\Python27\lib\encodings\uu_codec.py to encodings\uu_codec.pyo
byte-compiling C:\Python27\lib\encodings\zlib_codec.py to encodings\zlib_codec.pyo
byte-compiling C:\Python27\lib\fnmatch.py to fnmatch.pyo
byte-compiling C:\Python27\lib\ftplib.py to ftplib.pyo
byte-compiling C:\Python27\lib\functools.py to functools.pyo
byte-compiling C:\Python27\lib\genericpath.py to genericpath.pyo
byte-compiling C:\Python27\lib\getopt.py to getopt.pyo
byte-compiling C:\Python27\lib\getpass.py to getpass.pyo
byte-compiling C:\Python27\lib\gettext.py to gettext.pyo
byte-compiling C:\Python27\lib\gzip.py to gzip.pyo
byte-compiling C:\Python27\lib\hashlib.py to hashlib.pyo
byte-compiling C:\Python27\lib\heapq.py to heapq.pyo
byte-compiling C:\Python27\lib\hmac.py to hmac.pyo
byte-compiling C:\Python27\lib\httplib.py to httplib.pyo
byte-compiling C:\Python27\lib\inspect.py to inspect.pyo
byte-compiling C:\Python27\lib\io.py to io.pyo
byte-compiling C:\Python27\lib\keyword.py to keyword.pyo
byte-compiling C:\Python27\lib\linecache.py to linecache.pyo
byte-compiling C:\Python27\lib\locale.py to locale.pyo
byte-compiling C:\Python27\lib\logging\__init__.py to logging\__init__.pyo
byte-compiling C:\Python27\lib\mimetools.py to mimetools.pyo
byte-compiling C:\Python27\lib\mimetypes.py to mimetypes.pyo
byte-compiling C:\Python27\lib\multiprocessing\__init__.py to multiprocessing\__init__.pyo
byte-compiling C:\Python27\lib\multiprocessing\connection.py to multiprocessing\connection.pyo
byte-compiling C:\Python27\lib\multiprocessing\dummy\__init__.py to multiprocessing\dummy\__init__.pyo
byte-compiling C:\Python27\lib\multiprocessing\dummy\connection.py to multiprocessing\dummy\connection.pyo
byte-compiling C:\Python27\lib\multiprocessing\forking.py to multiprocessing\forking.pyo
byte-compiling C:\Python27\lib\multiprocessing\heap.py to multiprocessing\heap.pyo
byte-compiling C:\Python27\lib\multiprocessing\managers.py to multiprocessing\managers.pyo
byte-compiling C:\Python27\lib\multiprocessing\pool.py to multiprocessing\pool.pyo
byte-compiling C:\Python27\lib\multiprocessing\process.py to multiprocessing\process.pyo
byte-compiling C:\Python27\lib\multiprocessing\queues.py to multiprocessing\queues.pyo
byte-compiling C:\Python27\lib\multiprocessing\reduction.py to multiprocessing\reduction.pyo
byte-compiling C:\Python27\lib\multiprocessing\sharedctypes.py to multiprocessing\sharedctypes.pyo
byte-compiling C:\Python27\lib\multiprocessing\synchronize.py to multiprocessing\synchronize.pyo
byte-compiling C:\Python27\lib\multiprocessing\util.py to multiprocessing\util.pyo
byte-compiling C:\Python27\lib\ntpath.py to ntpath.pyo
byte-compiling C:\Python27\lib\nturl2path.py to nturl2path.pyo
byte-compiling C:\Python27\lib\opcode.py to opcode.pyo
byte-compiling C:\Python27\lib\optparse.py to optparse.pyo
byte-compiling C:\Python27\lib\os.py to os.pyo
byte-compiling C:\Python27\lib\os2emxpath.py to os2emxpath.pyo
byte-compiling C:\Python27\lib\pdb.py to pdb.pyo
byte-compiling C:\Python27\lib\pickle.py to pickle.pyo
byte-compiling C:\Python27\lib\posixpath.py to posixpath.pyo
byte-compiling C:\Python27\lib\pprint.py to pprint.pyo
byte-compiling C:\Python27\lib\py_compile.py to py_compile.pyo
byte-compiling C:\Python27\lib\quopri.py to quopri.pyo
byte-compiling C:\Python27\lib\random.py to random.pyo
byte-compiling C:\Python27\lib\re.py to re.pyo
byte-compiling C:\Python27\lib\repr.py to repr.pyo
byte-compiling C:\Python27\lib\rfc822.py to rfc822.pyo
byte-compiling C:\Python27\lib\shlex.py to shlex.pyo
byte-compiling C:\Python27\lib\shutil.py to shutil.pyo
byte-compiling C:\Python27\lib\site-packages\pygame\__init__.py to pygame\__init__.pyo
byte-compiling C:\Python27\lib\site-packages\pygame\_numpysndarray.py to pygame\_numpysndarray.pyo
byte-compiling C:\Python27\lib\site-packages\pygame\_numpysurfarray.py to pygame\_numpysurfarray.pyo
byte-compiling C:\Python27\lib\site-packages\pygame\colordict.py to pygame\colordict.pyo
byte-compiling C:\Python27\lib\site-packages\pygame\compat.py to pygame\compat.pyo
byte-compiling C:\Python27\lib\site-packages\pygame\cursors.py to pygame\cursors.pyo
byte-compiling C:\Python27\lib\site-packages\pygame\locals.py to pygame\locals.pyo
byte-compiling C:\Python27\lib\site-packages\pygame\mac_scrap.py to pygame\mac_scrap.pyo
byte-compiling C:\Python27\lib\site-packages\pygame\macosx.py to pygame\macosx.pyo
byte-compiling C:\Python27\lib\site-packages\pygame\pkgdata.py to pygame\pkgdata.pyo
byte-compiling C:\Python27\lib\site-packages\pygame\sndarray.py to pygame\sndarray.pyo
byte-compiling C:\Python27\lib\site-packages\pygame\sprite.py to pygame\sprite.pyo
byte-compiling C:\Python27\lib\site-packages\pygame\surfarray.py to pygame\surfarray.pyo
byte-compiling C:\Python27\lib\site-packages\pygame\sysfont.py to pygame\sysfont.pyo
byte-compiling C:\Python27\lib\site-packages\pygame\threads\Py25Queue.py to pygame\threads\Py25Queue.pyo
byte-compiling C:\Python27\lib\site-packages\pygame\threads\__init__.py to pygame\threads\__init__.pyo
byte-compiling C:\Python27\lib\site-packages\pygame\version.py to pygame\version.pyo
byte-compiling C:\Python27\lib\site-packages\zipextimporter.py to zipextimporter.pyo
byte-compiling C:\Python27\lib\socket.py to socket.pyo
byte-compiling C:\Python27\lib\sre.py to sre.pyo
byte-compiling C:\Python27\lib\sre_compile.py to sre_compile.pyo
byte-compiling C:\Python27\lib\sre_constants.py to sre_constants.pyo
byte-compiling C:\Python27\lib\sre_parse.py to sre_parse.pyo
byte-compiling C:\Python27\lib\ssl.py to ssl.pyo
byte-compiling C:\Python27\lib\stat.py to stat.pyo
byte-compiling C:\Python27\lib\string.py to string.pyo
byte-compiling C:\Python27\lib\stringprep.py to stringprep.pyo
byte-compiling C:\Python27\lib\struct.py to struct.pyo
byte-compiling C:\Python27\lib\subprocess.py to subprocess.pyo
byte-compiling C:\Python27\lib\tarfile.py to tarfile.pyo
byte-compiling C:\Python27\lib\tempfile.py to tempfile.pyo
byte-compiling C:\Python27\lib\textwrap.py to textwrap.pyo
byte-compiling C:\Python27\lib\threading.py to threading.pyo
byte-compiling C:\Python27\lib\token.py to token.pyo
byte-compiling C:\Python27\lib\tokenize.py to tokenize.pyo
byte-compiling C:\Python27\lib\traceback.py to traceback.pyo
byte-compiling C:\Python27\lib\types.py to types.pyo
byte-compiling C:\Python27\lib\unittest\__init__.py to unittest\__init__.pyo
byte-compiling C:\Python27\lib\unittest\case.py to unittest\case.pyo
byte-compiling C:\Python27\lib\unittest\loader.py to unittest\loader.pyo
byte-compiling C:\Python27\lib\unittest\main.py to unittest\main.pyo
byte-compiling C:\Python27\lib\unittest\result.py to unittest\result.pyo
byte-compiling C:\Python27\lib\unittest\runner.py to unittest\runner.pyo
byte-compiling C:\Python27\lib\unittest\signals.py to unittest\signals.pyo
byte-compiling C:\Python27\lib\unittest\suite.py to unittest\suite.pyo
byte-compiling C:\Python27\lib\unittest\util.py to unittest\util.pyo
byte-compiling C:\Python27\lib\urllib.py to urllib.pyo
byte-compiling C:\Python27\lib\urlparse.py to urlparse.pyo
byte-compiling C:\Python27\lib\uu.py to uu.pyo
byte-compiling C:\Python27\lib\warnings.py to warnings.pyo
byte-compiling C:\Python27\lib\weakref.py to weakref.pyo
byte-compiling C:\Python27\lib\xml\__init__.py to xml\__init__.pyo
byte-compiling C:\Python27\lib\xml\parsers\__init__.py to xml\parsers\__init__.pyo
byte-compiling C:\Python27\lib\xml\parsers\expat.py to xml\parsers\expat.pyo
byte-compiling C:\Python27\lib\xmllib.py to xmllib.pyo
byte-compiling C:\Python27\lib\xmlrpclib.py to xmlrpclib.pyo
byte-compiling C:\Python27\lib\zipfile.py to zipfile.pyo
byte-compiling C:\Users\micah_000\Downloads\pong-master\data\AI.py to data\AI.pyo
byte-compiling C:\Users\micah_000\Downloads\pong-master\data\__init__.py to data\__init__.pyo
byte-compiling C:\Users\micah_000\Downloads\pong-master\data\ball.py to data\ball.pyo
byte-compiling C:\Users\micah_000\Downloads\pong-master\data\control.py to data\control.pyo
byte-compiling C:\Users\micah_000\Downloads\pong-master\data\main.py to data\main.pyo
byte-compiling C:\Users\micah_000\Downloads\pong-master\data\paddle.py to data\paddle.pyo
byte-compiling C:\Users\micah_000\Downloads\pong-master\data\sound.py to data\sound.pyo
byte-compiling C:\Users\micah_000\Downloads\pong-master\data\states\__init__.py to data\states\__init__.pyo
byte-compiling C:\Users\micah_000\Downloads\pong-master\data\states\audio.py to data\states\audio.pyo
byte-compiling C:\Users\micah_000\Downloads\pong-master\data\states\classic.py to data\states\classic.pyo
byte-compiling C:\Users\micah_000\Downloads\pong-master\data\states\controls.py to data\states\controls.pyo
byte-compiling C:\Users\micah_000\Downloads\pong-master\data\states\ghost.py to data\states\ghost.pyo
byte-compiling C:\Users\micah_000\Downloads\pong-master\data\states\menu.py to data\states\menu.pyo
byte-compiling C:\Users\micah_000\Downloads\pong-master\data\states\mode.py to data\states\mode.pyo
byte-compiling C:\Users\micah_000\Downloads\pong-master\data\states\options.py to data\states\options.pyo
byte-compiling C:\Users\micah_000\Downloads\pong-master\data\states\splash.py to data\states\splash.pyo
byte-compiling C:\Users\micah_000\Downloads\pong-master\data\tools.py to data\tools.pyo
removing c:\users\micah_~1\appdata\local\temp\tmp4ftukm.py
*** copy extensions ***
copying C:\Python27\DLLs\_ctypes.pyd -> C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\collect-2.7
copying C:\Python27\DLLs\_hashlib.pyd -> C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\collect-2.7
copying C:\Python27\DLLs\_multiprocessing.pyd -> C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\collect-2.7
copying C:\Python27\DLLs\_socket.pyd -> C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\collect-2.7
copying C:\Python27\DLLs\_ssl.pyd -> C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\collect-2.7
copying C:\Python27\DLLs\bz2.pyd -> C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\collect-2.7
copying C:\Python27\DLLs\pyexpat.pyd -> C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\collect-2.7
copying C:\Python27\DLLs\select.pyd -> C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\collect-2.7
copying C:\Python27\DLLs\unicodedata.pyd -> C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\collect-2.7
copying C:\Python27\lib\site-packages\pygame\_arraysurfarray.pyd -> C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\collect-2.7\pygame
copying C:\Python27\lib\site-packages\pygame\_numericsndarray.pyd -> C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\collect-2.7\pygame
copying C:\Python27\lib\site-packages\pygame\_numericsurfarray.pyd -> C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\collect-2.7\pygame
copying C:\Python27\lib\site-packages\pygame\base.pyd -> C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\collect-2.7\pygame
copying C:\Python27\lib\site-packages\pygame\bufferproxy.pyd -> C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\collect-2.7\pygame
copying C:\Python27\lib\site-packages\pygame\cdrom.pyd -> C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\collect-2.7\pygame
copying C:\Python27\lib\site-packages\pygame\color.pyd -> C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\collect-2.7\pygame
copying C:\Python27\lib\site-packages\pygame\constants.pyd -> C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\collect-2.7\pygame
copying C:\Python27\lib\site-packages\pygame\display.pyd -> C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\collect-2.7\pygame
copying C:\Python27\lib\site-packages\pygame\draw.pyd -> C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\collect-2.7\pygame
copying C:\Python27\lib\site-packages\pygame\event.pyd -> C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\collect-2.7\pygame
copying C:\Python27\lib\site-packages\pygame\fastevent.pyd -> C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\collect-2.7\pygame
copying C:\Python27\lib\site-packages\pygame\font.pyd -> C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\collect-2.7\pygame
copying C:\Python27\lib\site-packages\pygame\image.pyd -> C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\collect-2.7\pygame
copying C:\Python27\lib\site-packages\pygame\imageext.pyd -> C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\collect-2.7\pygame
copying C:\Python27\lib\site-packages\pygame\joystick.pyd -> C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\collect-2.7\pygame
copying C:\Python27\lib\site-packages\pygame\key.pyd -> C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\collect-2.7\pygame
copying C:\Python27\lib\site-packages\pygame\mask.pyd -> C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\collect-2.7\pygame
copying C:\Python27\lib\site-packages\pygame\mixer.pyd -> C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\collect-2.7\pygame
copying C:\Python27\lib\site-packages\pygame\mixer_music.pyd -> C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\collect-2.7\pygame
copying C:\Python27\lib\site-packages\pygame\mouse.pyd -> C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\collect-2.7\pygame
copying C:\Python27\lib\site-packages\pygame\movie.pyd -> C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\collect-2.7\pygame
copying C:\Python27\lib\site-packages\pygame\overlay.pyd -> C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\collect-2.7\pygame
copying C:\Python27\lib\site-packages\pygame\pixelarray.pyd -> C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\collect-2.7\pygame
copying C:\Python27\lib\site-packages\pygame\rect.pyd -> C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\collect-2.7\pygame
copying C:\Python27\lib\site-packages\pygame\rwobject.pyd -> C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\collect-2.7\pygame
copying C:\Python27\lib\site-packages\pygame\scrap.pyd -> C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\collect-2.7\pygame
copying C:\Python27\lib\site-packages\pygame\surface.pyd -> C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\collect-2.7\pygame
copying C:\Python27\lib\site-packages\pygame\surflock.pyd -> C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\collect-2.7\pygame
copying C:\Python27\lib\site-packages\pygame\time.pyd -> C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\collect-2.7\pygame
copying C:\Python27\lib\site-packages\pygame\transform.pyd -> C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\collect-2.7\pygame
copying C:\Python27\lib\site-packages\pygame\freesansbold.ttf -> C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\collect-2.7\pygame
*** copy dlls ***
copying C:\Python27\lib\site-packages\pygame\libogg-0.dll -> C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\collect-2.7
copying C:\Python27\lib\site-packages\pygame\SDL_mixer.dll -> C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\collect-2.7
copying C:\WINDOWS\system32\python27.dll -> C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\bundle-2.7
setting sys.winver for 'C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\bundle-2.7\python27.dll' to 'Pong'
copying C:\Python27\lib\site-packages\pygame\SDL_image.dll -> C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\collect-2.7
copying C:\Python27\lib\site-packages\pygame\libvorbis-0.dll -> C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\collect-2.7
copying C:\Python27\lib\site-packages\pygame\libvorbisfile-3.dll -> C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\collect-2.7
copying C:\Python27\lib\site-packages\pygame\SDL_ttf.dll -> C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\collect-2.7
copying C:\Python27\lib\site-packages\pygame\zlib1.dll -> C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\collect-2.7
copying C:\Python27\lib\site-packages\pygame\smpeg.dll -> C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\collect-2.7
copying C:\Python27\lib\site-packages\pygame\jpeg.dll -> C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\collect-2.7
copying C:\Python27\lib\site-packages\pygame\libfreetype-6.dll -> C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\collect-2.7
copying C:\Python27\lib\site-packages\pygame\SDL.dll -> C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\collect-2.7
copying C:\Python27\lib\site-packages\pygame\libpng12-0.dll -> C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\collect-2.7
copying C:\Python27\w9xpopen.exe -> C:\Users\micah_000\Downloads\pong-master\dist
copying C:\Python27\lib\site-packages\pygame\libtiff.dll -> C:\Users\micah_000\Downloads\pong-master\build\bdist.win32\winexe\collect-2.7
copying C:\Python27\lib\site-packages\py2exe\run_w.exe -> C:\Users\micah_000\Downloads\pong-master\dist\game.exe
Adding python27.dll as resource to C:\Users\micah_000\Downloads\pong-master\dist\game.exe
The following modules appear to be missing
['AppKit', 'Foundation', 'Numeric', 'OpenGL.GL', '_scproxy', '_sysconfigdata', 'copyreg', 'dummy.Process', 'numpy', 'pkg_resources', 'queue', 'winreg', 'pygame.sdlmain_osx']

*** binary dependencies ***
Your executable(s) also depend on these dlls which are not included,
you may or may not need to distribute them.

Make sure you have the license if you distribute any of them, and
make sure you don't distribute files belonging to the operating system.

   OLEAUT32.dll - C:\WINDOWS\system32\OLEAUT32.dll
   USER32.dll - C:\WINDOWS\system32\USER32.dll
   SHELL32.dll - C:\WINDOWS\system32\SHELL32.dll
   ole32.dll - C:\WINDOWS\system32\ole32.dll
   WINMM.DLL - C:\WINDOWS\system32\WINMM.DLL
   ADVAPI32.DLL - C:\WINDOWS\system32\ADVAPI32.DLL
   WS2_32.DLL - C:\WINDOWS\system32\WS2_32.DLL
   GDI32.dll - C:\WINDOWS\system32\GDI32.dll
   KERNEL32.dll - C:\WINDOWS\system32\KERNEL32.dll
Press any key to continue


The directory structure for the program is. I am not sure where i would define the structure for py2exe
Code: Select all
/pong
    game.py #startup script
    /data
        PY_FILES.py
        /states
            PY_STATES.py
    /resources
        /fonts
            ...
        /graphics
            ...
        /music
            ...
        /sound
            ...


and upon execution of dist/game.exe pops up a pygame window, with a message sayign to check logfile. Upon checking the logfile, the only thing that pops out is:
Code: Select all
Adding python27.dll as resource to C:\Users\micah_000\Downloads\pong-master\dist\game.exe
The following modules appear to be missing
['AppKit', 'Foundation', 'Numeric', 'OpenGL.GL', '_scproxy', '_sysconfigdata', 'copyreg', 'dummy.Process', 'numpy', 'pkg_resources', 'queue', 'winreg', 'pygame.sdlmain_osx']

*** binary dependencies ***
Your executable(s) also depend on these dlls which are not included,
you may or may not need to distribute them.

but i have no idea how to correct this, if this is the problem.

https://github.com/metulburr/pong
New Users, Read This
version Python 3.3.2 and 2.7.5, tkinter 8.5, pyqt 4.8.4, pygame 1.9.2 pre
OS Ubuntu 13.04, Mint 11, Arch Linux, Gentoo, Windows 7/8
https://github.com/metulburr
User avatar
metulburr
 
Posts: 1096
Joined: Thu Feb 07, 2013 4:47 pm
Location: Elmira, NY

Re: [Pygame] making an exe for pygame

Postby Mekire » Wed Jan 15, 2014 7:04 am

Were you running windows when you did this?

I added the line:
Code: Select all
import pygame._view
to your main script.

This is my py2exe script:
Code: Select all
import os
import sys
import py2exe
from distutils.core import setup

origIsSystemDLL = py2exe.build_exe.isSystemDLL
def isSystemDLL(pathname):
    dlls = ("libfreetype-6.dll", "libogg-0.dll", "sdl_ttf.dll")
    if os.path.basename(pathname).lower() in dlls:
        return 0
    return origIsSystemDLL(pathname)
py2exe.build_exe.isSystemDLL = isSystemDLL

sys.argv.append('py2exe')
setup(options={'py2exe': {'bundle_files': 1, 'compressed': True}},
      windows=[{'script': "game.py"}],
      zipfile=None)

I ran that and then copied the resource folder into the dist directory.

Worked fine. Here is a link if you can't get it to work yourself:
http://www.mediafire.com/download/rttuaow7h6fqnaj/pong.zip

-Mek
User avatar
Mekire
 
Posts: 816
Joined: Thu Feb 07, 2013 11:33 pm
Location: Amakusa, Japan

Re: [Pygame] making an exe for pygame

Postby metulburr » Wed Jan 15, 2014 12:43 pm

Were you running windows when you did this?

yes, i was running windows 8

I added the line:
Code: Select all
import pygame._view
to your main script.

So this is required then? In pygame2exe.py

This is my py2exe script:

Did you do this build with that pygame2exe script after the modification or your py2exe setup script? I for some reason thought you had to define the structure for py2exe?

I will recheck this when i reboot into windows later

EDIT:
oh ok im a dummy, i didnt copy the resource directory over into the exe directory, that made it work. However, your script is smaller and works, so i am not sure what all the horse-hockey is for pygame2exe script they have on pygame. Thanks
New Users, Read This
version Python 3.3.2 and 2.7.5, tkinter 8.5, pyqt 4.8.4, pygame 1.9.2 pre
OS Ubuntu 13.04, Mint 11, Arch Linux, Gentoo, Windows 7/8
https://github.com/metulburr
User avatar
metulburr
 
Posts: 1096
Joined: Thu Feb 07, 2013 4:47 pm
Location: Elmira, NY

Re: [Pygame] making an exe for pygame

Postby Mekire » Thu Jan 16, 2014 12:47 am

It is theoretically possible to get the script to automatically add your resources to the dist; I have never gotten this to work with anything but the simplest cases and find it much easier to just copy the resource folder over manually. My script was copied from several sources, pygame2exe being one of them.

Part of the complexity of their script deals with a font issue that can occur. I generally avoid this issue by not using default or SysFonts in my final releases. If you always include the font you want with your program it should never be an issue (I think).

-Mek
User avatar
Mekire
 
Posts: 816
Joined: Thu Feb 07, 2013 11:33 pm
Location: Amakusa, Japan

Re: [Pygame] making an exe for pygame

Postby metulburr » Thu Jan 16, 2014 1:02 am

Ill have to check up on that. Maybe at some point we can figure how out how to add the resources in as well.

Yeah i read that as well. It would seem a lot easier just to include a font... since you already have a resource (images, mp3's, wav) that you are including anyways.
New Users, Read This
version Python 3.3.2 and 2.7.5, tkinter 8.5, pyqt 4.8.4, pygame 1.9.2 pre
OS Ubuntu 13.04, Mint 11, Arch Linux, Gentoo, Windows 7/8
https://github.com/metulburr
User avatar
metulburr
 
Posts: 1096
Joined: Thu Feb 07, 2013 4:47 pm
Location: Elmira, NY

Re: [Pygame] making an exe for pygame

Postby metulburr » Thu Jan 16, 2014 11:59 am

Found something weird...If i run the exe, and play ghosts, sometimes the exe closes in the middle of the game with a message the exe encountered an errror, and the game closes. This only happens when run via exe. No errors when using python to start it manually. Not sure what thay means.
New Users, Read This
version Python 3.3.2 and 2.7.5, tkinter 8.5, pyqt 4.8.4, pygame 1.9.2 pre
OS Ubuntu 13.04, Mint 11, Arch Linux, Gentoo, Windows 7/8
https://github.com/metulburr
User avatar
metulburr
 
Posts: 1096
Joined: Thu Feb 07, 2013 4:47 pm
Location: Elmira, NY

Re: [Pygame] making an exe for pygame

Postby Mekire » Thu Jan 16, 2014 1:19 pm

Can you narrow it down at all? When does it crash? I left it running on ghosts and came back a while later; it had almost 300 ghosts and was still happily running.

-Mek
User avatar
Mekire
 
Posts: 816
Joined: Thu Feb 07, 2013 11:33 pm
Location: Amakusa, Japan

Re: [Pygame] making an exe for pygame

Postby metulburr » Thu Jan 16, 2014 1:38 pm

maybe its just wine crashing then. Its so weird though that it will randomly crash. Thats prolly my fault for not testing directly under windows.
New Users, Read This
version Python 3.3.2 and 2.7.5, tkinter 8.5, pyqt 4.8.4, pygame 1.9.2 pre
OS Ubuntu 13.04, Mint 11, Arch Linux, Gentoo, Windows 7/8
https://github.com/metulburr
User avatar
metulburr
 
Posts: 1096
Joined: Thu Feb 07, 2013 4:47 pm
Location: Elmira, NY

Re: [Pygame] making an exe for pygame

Postby metulburr » Sat Jan 18, 2014 5:50 am

regarding including the resources directory:

I am not sure if this is it or not, but i came a cross others with trying to include their images into the exe as well, and they were using pkg_resources
Code: Select all
import pkg_resources
img = pkg_resources.resource_string(__name__, 'Downloads/snake.jpg')

although i dont have to time to look well into it, nor would i understand it if i did, lol
New Users, Read This
version Python 3.3.2 and 2.7.5, tkinter 8.5, pyqt 4.8.4, pygame 1.9.2 pre
OS Ubuntu 13.04, Mint 11, Arch Linux, Gentoo, Windows 7/8
https://github.com/metulburr
User avatar
metulburr
 
Posts: 1096
Joined: Thu Feb 07, 2013 4:47 pm
Location: Elmira, NY


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest