Hi Again, I changed the error that happened on the compiled version which was line 26 where I was calling a import pygame.mixer. It states at that point it can ot find a DLL when I run the compiled py2exe made .exe file. So, I changed it to not import single modules and the error below happened on compile. So, no .exe was even made just by changing one line. Note: This program, PlayMusic.py or Playing.py, or any uncompiled version runs perfectly as I designed it by clicking on it or running it from the command line. The error below comes up by only importing Pygame without single imports such as Pygame.Mixer where it will compile but fails when running it, I mean running the compiled .exe file.
Inside my batch file I check for the .exe file and if not created I state "No Compile" at the very end. Bruce Failure when importing Pygame without specifics: This is the last step when attempting to copy DLLS *** copy dlls *** copying c:\python27\lib\site-packages\pygame\SDL_mixer.dll -> C:\Make\dist copying C:\WINDOWS\system32\python27.dll -> C:\Make\dist setting sys.winver for 'C:\Make\dist\python27.dll' to 'py2exe' Traceback (most recent call last): File "SetUp4.py", line 107, in <module> 'script':dest, File "c:\python27\lib\distutils\core.py", line 152, in setup dist.run_commands() File "c:\python27\lib\distutils\dist.py", line 953, in run_commands self.run_command(cmd) File "c:\python27\lib\distutils\dist.py", line 972, in run_command cmd_obj.run() File "c:\python27\lib\site-packages\py2exe\build_exe.py", line 243, in run self._run() File "c:\python27\lib\site-packages\py2exe\build_exe.py", line 312, in _run self.create_binaries(py_files, extensions, dlls) File "c:\python27\lib\site-packages\py2exe\build_exe.py", line 525, in create_ binaries self.copy_dlls(dlls) File "c:\python27\lib\site-packages\py2exe\build_exe.py", line 471, in copy_dl ls self.patch_python_dll_winver(dst) File "c:\python27\lib\site-packages\py2exe\build_exe.py", line 1008, in patch_ python_dll_winver add_resource(unicode_name, mfest, RT_MANIFEST, 2, False) RuntimeError: EndUpdateResource: The system cannot open the device or file specified. Error! No Compile! Sent: Friday, December 30, 2011 8:19 AM Subject: [Distutils] Problem Using Python 2.7 and Py2Exe with Pygame Module Hi! I am getting errors and missing modules now that I have loaded Python2.7 and the Pygame modules, but works fine on my old machine using Python2.5 I would like to know what is going wrong here? I also looked on the web and lots of people are having the same problems. Does this mean that Python 2.7 is not wise to use along with Py2Exe when using Pygame modules? Below is the errors and at the end is my Setup file: *** copy extensions *** *** copy dlls *** copying c:\python27\lib\site-packages\py2exe\run.exe -> C:\Make\dist\MusicPlayer.exe The following modules appear to be missing ['AppKit', 'Foundation', 'Numeric', 'OpenGL.GL', '_scproxy', '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 libogg-0.dll - c:\python27\lib\site-packages\pygame\libogg-0.dll KERNEL32.dll - C:\WINDOWS\system32\KERNEL32.dll SDL_ttf.dll - c:\python27\lib\site-packages\pygame\SDL_ttf.dll The MusicPlayer.exe Has Been Made And Is Located In The Dist Directory! Setup.py File: PY_PROG = "music.py" APP_NAME = "MusicPlayer" cfg = { 'name':APP_NAME, 'version':'1.0', 'description':'', 'author':'', 'author_email':'', 'url':'', 'py2exe.target':'', # 'py2exe.icon':'icon.ico', #64x64 'py2exe.binary':APP_NAME, #leave off the .exe, it will be added 'py2app.target':'', 'py2app.icon':'icon.icns', #128x128 'cx_freeze.cmd':'~/src/cx_Freeze-3.0.3/FreezePython', 'cx_freeze.target':'', 'cx_freeze.binary':APP_NAME, } # usage: python setup.py command # # sdist - build a source dist # py2exe - build an exe # py2app - build an app # cx_freeze - build a linux binary (not implemented) # # the goods are placed in the dist dir for you to .zip up or whatever... from distutils.core import setup, Extension try: import py2exe except: pass import sys import glob import os import shutil try: cmd = sys.argv[1] except IndexError: print 'Usage: setup.py py2exe|py2app|cx_freeze' raise SystemExit # utility for adding subdirectories def add_files( dest, generator): for dirpath, dirnames, filenames in generator: for name in 'CVS', '.svn': if name in dirnames: dirnames.remove(name) for name in filenames: if '~' in name: continue suffix = os.path.splitext(name)[1] if suffix in ('.pyc', '.pyo'): continue if name[0] == '.': continue filename = os.path.join(dirpath, name) dest.append(filename) # define what is our data data = [] add_files( data, os.walk('data')) data.extend( glob.glob('*.txt')) # define what is our source src = [] add_files( src, os.walk('lib')) src.extend( glob.glob('*.py')) # build the sdist target if cmd == 'sdist': f = open( "MANIFEST.in", "w") for l in data: f.write("include "+l+"\n") for l in src: f.write("include "+l+"\n") f.close() setup( name=cfg['name'], version=cfg['version'], description=cfg['description'], author=cfg['author'], author_email=cfg['author_email'], url=cfg['url'], ) # build the py2exe target if cmd in ('py2exe',): dist_dir = os.path.join('dist',cfg['py2exe.target']) data_dir = dist_dir src = PY_PROG dest = cfg['py2exe.binary']+'.py' shutil.copy(src,dest) setup( options={'py2exe':{ 'dist_dir':dist_dir, 'dll_excludes':['_dotblas.pyd','_numpy.pyd'] }}, # windows=[{ console=[{ 'script':dest, # 'icon_resources':[(1,cfg['py2exe.icon'])], }], ) # build the py2app target if cmd == 'py2app': dist_dir = os.path.join('dist',cfg['py2app.target']+'.app') data_dir = os.path.join(dist_dir,'Contents','Resources') from setuptools import setup src = PY_PROG dest = cfg['py2app.target']+'.py' shutil.copy(src,dest) APP = [dest] DATA_FILES = [] OPTIONS = {'argv_emulation': True, 'iconfile':cfg['py2app.icon']} setup( app=APP, data_files=DATA_FILES, options={'py2app': OPTIONS}, setup_requires=['py2app'], ) # make the cx_freeze target if cmd == 'cx_freeze': dist_dir = os.path.join('dist',cfg['cx_freeze.target']) data_dir = dist_dir os.system('%s --install-dir %s --target-name %s %s' % (cfg['cx_freeze.cmd'], cfg['cx_freeze.binary'], dist_dir, PY_PROG)) # recursively make a bunch of folders def make_dirs(dname_): parts = list(os.path.split(dname_)) dname = None while len(parts): if dname == None: dname = parts.pop(0) else: dname = os.path.join(dname,parts.pop(0)) if not os.path.isdir(dname): os.mkdir(dname) # copy data into the binaries if cmd in ('py2exe','cx_freeze','py2app'): dest = data_dir for fname in data: dname = os.path.join(dest,os.path.dirname(fname)) make_dirs(dname) if not os.path.isdir(fname): shutil.copy(fname,dname) _______________________________________________ Distutils-SIG maillist - Distutils-SIG@python.org http://mail.python.org/mailman/listinfo/distutils-sig _______________________________________________ Distutils-SIG maillist - Distutils-SIG@python.org http://mail.python.org/mailman/listinfo/distutils-sig