A lot of problem with pygame.mixer module!

A

Alex

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 = '(e-mail address removed)'
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

Sébastien Ouellet

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.

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 = '(e-mail address removed)'
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')
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top