A lot of problem with pygame.mixer module!

Discussion in 'Python' started by Alex, Jul 20, 2009.

  1. Alex

    Alex Guest

    hi at all,
    As email object I 'm not be able to run my program when compiled with
    py2exe.
    Everythink works fine until I try to make an exe.
    After that, it crash and in the log:

    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

    The code about pygame.mixer is only:

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

    in the dist folder there is SDL_mixer.dll so...HOW can I solve this
    problem ??
    thanks in advance
    Alex
    Below my setup.py

    # 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 = ''
    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')
     
    Alex, Jul 20, 2009
    #1
    1. Advertising

  2. I had the same problem and struggled through every solution posted on
    the web. None actually helped but I discovered bbfreeze :
    http://pypi.python.org/pypi/bbfreeze/
    It works as well as py2exe and there are no problems with
    pygame.mixer. It's easy to install and the example script at the end
    of the page does the trick.

    On 20 juil, 08:28, Alex <> wrote:
    > hi at all,
    > As email object I 'm not be able to run my program when compiled with
    > py2exe.
    > Everythink  works fine until I try to make an exe.
    > After that, it crash and in the log:
    >
    > 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
    >
    > The code about pygame.mixer is only:
    >
    > pygame.mixer.init()
    > music = pygame.mixer.Sound("popcorn.ogg")
    > music.play()
    >
    > in the dist folder there is SDL_mixer.dll so...HOW can I solve this
    > problem ??
    > thanks in advance
    > Alex
    > Below my setup.py
    >
    > # 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 = ''
    > 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')
     
    Sébastien Ouellet, Aug 29, 2009
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?ISO-8859-1?Q?Marian_Aldenh=F6vel?=

    pygame.mixer.music not playing

    =?ISO-8859-1?Q?Marian_Aldenh=F6vel?=, Feb 6, 2005, in forum: Python
    Replies:
    12
    Views:
    2,872
    =?ISO-8859-1?Q?Marian_Aldenh=F6vel?=
    Feb 7, 2005
  2. oss mixer usage

    , Jan 16, 2006, in forum: Python
    Replies:
    0
    Views:
    473
  3. soorya
    Replies:
    1
    Views:
    699
    mlimber
    Oct 27, 2005
  4. globalrev

    pygame.mixer.load not working

    globalrev, May 4, 2008, in forum: Python
    Replies:
    1
    Views:
    260
    Diez B. Roggisch
    May 4, 2008
  5. rantingrick

    [pygame-bug] Pygame.cdrom bug

    rantingrick, Jan 30, 2011, in forum: Python
    Replies:
    1
    Views:
    337
    Benjamin Kaplan
    Jan 30, 2011
Loading...

Share This Page