Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > A lot of problem with pygame.mixer module!

Reply
Thread Tools

A lot of problem with pygame.mixer module!

 
 
Alex
Guest
Posts: n/a
 
      07-20-2009
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 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')
 
Reply With Quote
 
 
 
 
Sébastien Ouellet
Guest
Posts: n/a
 
      08-29-2009
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 <(E-Mail Removed)> 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 = '(E-Mail 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')


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Firefox taking up A LOT of system resources? Jeff Ingram Firefox 9 04-16-2005 08:46 AM
the same problem...and thanx a lot Alessandro Giambruno Java 3 06-21-2004 08:15 AM
Free exam simulation software for vb6,vb.net,c sharp , sql server , java , GRE and lot shiv MCSD 0 09-01-2003 06:10 AM
best certification out of da lot? Steve Microsoft Certification 3 08-29-2003 11:09 PM



Advertisments