[Python] py2exe vs pygame !!!

Alex magobin a gmail.com
Lun 20 Lug 2009 17:35:10 CEST


Salve, non riesco a compilare un exe con la presenza di pygame.mixer

Quando lancio l'eseguibile nel log trovo:

C:\dist\sponge.exe:97: RuntimeWarning: use mixer: DLL load failed: The
specified module could not be found.
Traceback (most recent call last):
  File "sponge.py", line 97, in <module>
  File "pygame\__init__.pyo", line 70, in __getattr__
NotImplementedError: mixer module not available

Il codice presente nello script è solo questo;

pygame.mixer.init()
music = pygame.mixer.Sound("popcorn.ogg")
music.play()

Sapete dirmi come risolvere ????
Sotto riporto il mio setup.py

Alex


***************************
# py2exe setup program
from distutils.core import setup
import py2exe
import pygame
from modulefinder import Module
#from pygame import mixer
import ImageGrab
import sys
import os
import Tkinter
import glob, shutil
sys.argv.append("py2exe")
VERSION = '1.0'
AUTHOR_NAME = 'Your Name'
AUTHOR_EMAIL = 'your_em... a somewhere.com'
AUTHOR_URL = "http://www.urlofyourgamesite.com/"
PRODUCT_NAME = "Sponge"
SCRIPT_MAIN = 'sponge.py'
VERSIONSTRING = PRODUCT_NAME + " ALPHA " + VERSION
ICONFILE = 'icon.ico'
# Remove the build tree on exit automatically
REMOVE_BUILD_ON_EXIT = True
if os.path.exists('dist/'): shutil.rmtree('dist/')
extra_files = [ ("",[ICONFILE,'WinLockDll.dll','popcorn.ogg']),
                   #("data",glob.glob(os.path.join('data','*.dat'))),
                   #("gfx",glob.glob(os.path.join('gfx','*.jpg'))),
                   #("gfx",glob.glob(os.path.join('gfx','*.png'))),
                   ("fonts",glob.glob(os.path.join('fonts','*.ttf'))),
                   ("music",glob.glob(os.path.join('music','*.ogg')))]
                   #("snd",glob.glob(os.path.join('snd','*.wav')))]
# List of all modules to automatically exclude from distribution build
# This gets rid of extra modules that aren't necessary for proper
functioning of app
# You should only put things in this list if you know exactly what you
DON'T need
# This has the benefit of drastically reducing the size of your dist
MODULE_EXCLUDES =[
'email',
'AppKit',
'Foundation',
'bdb',
'difflib',
'tcl',
#'Tkinter',
#'Tkconstants',
'curses',
'distutils',
'setuptools',
'urllib',
'urllib2',
'urlparse',
'BaseHTTPServer',
'_LWPCookieJar',
'_MozillaCookieJar',
'ftplib',
'gopherlib',
'_ssl',
'htmllib',
'httplib',
'mimetools',
'mimetypes',
'rfc822',
'tty',
'webbrowser',
'socket',
'hashlib',
#'base64',
'compiler',
'pydoc'
]
INCLUDE_STUFF = ['encodings',"encodings.latin_1"]
setup(windows=[
             {'script': SCRIPT_MAIN,
               'other_resources': [(u"VERSIONTAG",1,VERSIONSTRING)],
               'icon_resources': [(1,ICONFILE)]}],
         options = {"py2exe": {
                             "optimize": 2,
                             "includes": INCLUDE_STUFF,
                             "compressed": 1,
                             "ascii": 1,
                             #"bundle_files": 1,
                             "ignores":
['tcl','AppKit','Numeric','Foundation'],
                             "excludes": MODULE_EXCLUDES} },
          name = PRODUCT_NAME,
          version = VERSION,
          data_files = extra_files,
          #zipfile = None,
          author = AUTHOR_NAME,
          author_email = AUTHOR_EMAIL,
          url = AUTHOR_URL)
# Create the /save folder for inclusion with the installer
#shutil.copytree('save','dist/save')
#if os.path.exists('dist/tcl'): shutil.rmtree('dist/tcl')
# Remove the build tree
if REMOVE_BUILD_ON_EXIT:
     shutil.rmtree('build/')
if os.path.exists('dist/tcl84.dll'): os.unlink('dist/tcl84.dll')
if os.path.exists('dist/tk84.dll'): os.unlink('dist/tk84.dll')


Maggiori informazioni sulla lista Python