Re: [pygame] mixer.music in runtime
I played with it some more, and it looks like when py2exe builds with the 'bundle_files':1 then pygame.mixer.music is accessible and functional - however without the bundle_files option, then the whole music not found thing happens so it seems like you can workaround this problem by making sure to use the 'bundle_files':1 option I still don't know what causes this problem and I don't know why it doesn't occur when the modules are bundled in an archive, tho On Wed, May 21, 2008 at 9:54 AM, Brian Fisher [EMAIL PROTECTED] wrote: ... however I tried making a very minimal py2exe script for main.py, and making an exe with that, and the exe works fine. So it seems that finding out what between my minimal setup script and Keith's (or Bo's) causes this problem to start occurring could help pin down what exactly it is about the environment that py2exe creates that breaks pygame's mixer.music importing and/or binding here is the minimal script that produces a working exe for me (you have to manually copy the audio files tho): -- from distutils.core import setup import py2exe import sys sys.argv.append(py2exe) setup(windows=['main.py'], options = {'py2exe': {'optimize': 2, 'bundle_files':1} }, zipfile=None)
Re: [pygame] mixer.music in runtime
Is sound card support enabled, tested, and working in your virtual environments? I have encountered errors similar to the ones you describe, only to discover that my virtual machine simply had the sound card emulation disabled. (that would still probably be a bug in pygame, for bad error detection of a missing soundcard) --- James On Tue, May 20, 2008 at 05:17:19PM -0700, Keith Nemitz wrote: I've started with fresh XP Sp2 installs on both VMWare and Parallels. Installed only what was necessary: Python, pygame, numeric, py2exe. As per earlier suggestion, I uninstalled py2exe 0.6.6 and installed 0.6.5. I don't think it's an install issue. --- René Dudfield [EMAIL PROTECTED] wrote: ah, Have you tried uninstalling (maybe manually deleting) pygame, py2exe etc then installing again? Maybe there's some problem with that... On Wed, May 21, 2008 at 9:31 AM, Keith Nemitz [EMAIL PROTECTED] wrote: Yep, It's in Program Files/(AppFolder)/lib. --- René Dudfield [EMAIL PROTECTED] wrote: hi, Do you have the smpeg dll copied in there? cu, On Wed, May 21, 2008 at 7:58 AM, Keith Nemitz [EMAIL PROTECTED] wrote: I get the following: AttributeError: 'module' object has no attribute 'mixer_music' --- Brian Fisher [EMAIL PROTECTED] wrote: I guess that means it imports correctly, but somehow fails to get bound? I don't suppose you can access the functionality you need through mixer_music, can you? In other words, what happens if you change the first failing pygame.mixer.music.whatever line to pygame.mixer_music.whatever? (after the import, of course) On Tue, May 20, 2008 at 11:17 AM, Keith Nemitz [EMAIL PROTECTED] wrote: I put your import line right above the failing line, but got exactly the same results. I even removed the try/exception block.
Re: [pygame] mixer.music in runtime
I can play sounds and music by running the pygame code in the interpreter. Only the build seems affected. I will look into this a bit more to see if there are any sound settings to fiddle with. --- James Paige [EMAIL PROTECTED] wrote: Is sound card support enabled, tested, and working in your virtual environments? I have encountered errors similar to the ones you describe, only to discover that my virtual machine simply had the sound card emulation disabled. (that would still probably be a bug in pygame, for bad error detection of a missing soundcard) --- James On Tue, May 20, 2008 at 05:17:19PM -0700, Keith Nemitz wrote: I've started with fresh XP Sp2 installs on both VMWare and Parallels. Installed only what was necessary: Python, pygame, numeric, py2exe. As per earlier suggestion, I uninstalled py2exe 0.6.6 and installed 0.6.5. I don't think it's an install issue. --- René Dudfield [EMAIL PROTECTED] wrote: ah, Have you tried uninstalling (maybe manually deleting) pygame, py2exe etc then installing again? Maybe there's some problem with that... On Wed, May 21, 2008 at 9:31 AM, Keith Nemitz [EMAIL PROTECTED] wrote: Yep, It's in Program Files/(AppFolder)/lib. --- René Dudfield [EMAIL PROTECTED] wrote: hi, Do you have the smpeg dll copied in there? cu, On Wed, May 21, 2008 at 7:58 AM, Keith Nemitz [EMAIL PROTECTED] wrote: I get the following: AttributeError: 'module' object has no attribute 'mixer_music' --- Brian Fisher [EMAIL PROTECTED] wrote: I guess that means it imports correctly, but somehow fails to get bound? I don't suppose you can access the functionality you need through mixer_music, can you? In other words, what happens if you change the first failing pygame.mixer.music.whatever line to pygame.mixer_music.whatever? (after the import, of course) On Tue, May 20, 2008 at 11:17 AM, Keith Nemitz [EMAIL PROTECTED] wrote: I put your import line right above the failing line, but got exactly the same results. I even removed the try/exception block.
Re: [pygame] mixer.music in runtime
OK, so I've tried the exe you built into an installer, and I get the AttributeError: 'module' object has no attribute 'music' error (which is a good thing - means the distribution files are consistent) I also tried making the exe with you setup file, and I get an exe which produces the same AttributeError: 'module' object has no attribute 'music' error. Playing around with things a small bit doesn't help me understand things any - importing pygame.mixer_music doesn't throw an error when py2exe'd, and the distribution includes mixer_music.pyd, but even before py2exe'd I can't access anything through pygame.mixer_music meaning the only thing that is different as far as I can tell is pygame.mixer.music doesn't show up... So it seems to be reproducible with the right scripts, but I'm not sure how to debug it and the behavior of the whole pygame.mixer_music import getting bound as pygame.mixer.music by mixer.c and music.c confuses me cause I don't understand it ... however I tried making a very minimal py2exe script for main.py, and making an exe with that, and the exe works fine. So it seems that finding out what between my minimal setup script and Keith's (or Bo's) causes this problem to start occurring could help pin down what exactly it is about the environment that py2exe creates that breaks pygame's mixer.music importing and/or binding here is the minimal script that produces a working exe for me (you have to manually copy the audio files tho): -- from distutils.core import setup import py2exe import sys sys.argv.append(py2exe) setup(windows=['main.py'], options = {'py2exe': {'optimize': 2, 'bundle_files':1} }, zipfile=None) On Tue, May 20, 2008 at 5:44 PM, Keith Nemitz [EMAIL PROTECTED] wrote: I've uploaded a minimal app that has the problem. http://p4.hostingprod.com/@mousechief.com/musicFailSetup.exe Here's the two relevant files: - audio py import pygame,os musicNames = []; #soundNames = [sangria,sonar,drop,badswap,chaching,wall]; soundNames = []; soundLib = {}; mixer = music = None; #Hogari_Hisaaki-Yasuko_Yamano-Beagle.ogg nextMusic = 0; musicVolume = 1.0; #0.4; musicFlag = True; lastSound = ; lastSndTime = 0; loopSound = None; def InitSounds(): global mixer, music, musicNames; #try: import pygame.mixer as pymix mixer = pymix; import pygame.mixer_music music = pymix.music; #except (ImportError, pygame.error): #return; tp = os.path.join('data','music'); tl = os.listdir(tp); for fname in tl: if (fname[-4] == '.'): musicNames.append(fname); music.set_volume(musicVolume); PlayMusic(); while music.get_busy(): pass pass def PlayMusic(name, loopCount=1): if (not music or not musicFlag): return; #check music loop preference if loop: loop = -1; loop = loopCount; if music.get_busy(): #we really should fade out nicely and #wait for the end music event, for now, CUT music.stop(); fullname = os.path.join('data', 'music', name); if (os.access(fullname,os.F_OK)): music.load(fullname); else: fullname = os.path.join('data', 'sounds', name); music.load(fullname); music.play(loop); return; - setup.py # A setup script showing how to extend py2exe. # # In this case, the py2exe command is subclassed to create an installation # script for InnoSetup, which can be compiled with the InnoSetup compiler # to a single file windows installer. # # By default, the installer will be created as dist\Output\setup.exe. from distutils.core import setup import py2exe import sys import shutil # arguments for the setup() call brigiton = dict( script = main.py, dest_base = rprog\brigiton, icon_resources = [(1,DHSGiT.ico)]) zipfile = rlib\shardlib options = {py2exe: {compressed: 0, optimize: 2}, } #dataList = []; #glob.glob(data\\*); #scan data folder for files and append in form data\file import os class InnoScript: def __init__(self, name, lib_dir, dist_dir, windows_exe_files = [], lib_files = [], data_files = [], version = 1.0.2.0): #another one down below. self.lib_dir = lib_dir self.dist_dir = dist_dir if not self.dist_dir[-1] in \\/: self.dist_dir += \\ self.name = name self.version = version self.windows_exe_files = [self.chop(p) for p in windows_exe_files] self.lib_files = [self.chop(p) for p in lib_files] def chop(self, pathname): assert pathname.startswith(self.dist_dir) return
Re: [pygame] mixer.music in runtime
I'm having the same trouble. Unfortunately for me, all of the suggested remedies failed. If I build the game with 1.7 pygame.mixer.music works. Under 1.8 I get the message: AttributeError: 'module' object has no attribute 'music' I tried using py2exe 0.6.6 and 0.6.5. I have XP SP2. Fails in Parallels and VMWare: Fusion. Don't have a 'real' pc anymore. Has anyone investigated this further? Here is my build file and the relevant part of my audio.py # A setup script showing how to extend py2exe. # # In this case, the py2exe command is subclassed to create an installation # script for InnoSetup, which can be compiled with the InnoSetup compiler # to a single file windows installer. # # By default, the installer will be created as dist\Output\setup.exe. from distutils.core import setup import py2exe import sys import shutil # arguments for the setup() call brigiton = dict( script = main.py, dest_base = rprog\brigiton, icon_resources = [(1,DHSGiT.ico)]) zipfile = rlib\shardlib options = {py2exe: {compressed: 0, optimize: 2}, } #dataList = []; #glob.glob(data\\*); #scan data folder for files and append in form data\file import os class InnoScript: def __init__(self, name, lib_dir, dist_dir, windows_exe_files = [], lib_files = [], data_files = [], version = 1.0.2.0): #another one down below. self.lib_dir = lib_dir self.dist_dir = dist_dir if not self.dist_dir[-1] in \\/: self.dist_dir += \\ self.name = name self.version = version self.windows_exe_files = [self.chop(p) for p in windows_exe_files] self.lib_files = [self.chop(p) for p in lib_files] def chop(self, pathname): assert pathname.startswith(self.dist_dir) return pathname[len(self.dist_dir):] def create(self, pathname=dist\\brigiton.iss): self.pathname = pathname ofi = self.file = open(pathname, w) print ofi, ; WARNING: This script has been created by py2exe. Changes to this script print ofi, ; will be overwritten the next time py2exe is run! print ofi, r[Setup] print ofi, rAppName=%s % self.name print ofi, rAppVerName=%s %s % (self.name, self.version) print ofi, rDefaultDirName={pf}\%s % self.name print ofi, rDefaultGroupName=%s % self.name print ofi print ofi, r[Dirs] print ofi, r'Name: {app}\prog\data' print ofi, r'Name: {app}\prog\data\actors' #print ofi, r'Name: {app}\prog\data\anims' print ofi, r'Name: {app}\prog\data\animations' print ofi, r'Name: {app}\prog\data\backdrops' print ofi, r'Name: {app}\prog\data\buttons' print ofi, r'Name: {app}\prog\data\fonts' print ofi, r'Name: {app}\prog\data\icons' print ofi, r'Name: {app}\prog\data\music' print ofi, r'Name: {app}\prog\data\sounds' print ofi, r'Name: {app}\prog\data\trouble' print ofi print ofi, r[Files] #print ofi, r'Source: prog\data\*; DestDir: {app}\prog\data; Flags: ignoreversion' print ofi, r'Source: prog\data\actors\*; DestDir: {app}\prog\data\actors; Flags: ignoreversion' #print ofi, r'Source: prog\data\anims\*; DestDir: {app}\prog\data\anims; Flags: ignoreversion' print ofi, r'Source: prog\data\animations\*; DestDir: {app}\prog\data\animations; Flags: ignoreversion' print ofi, r'Source: prog\data\backdrops\*; DestDir: {app}\prog\data\backdrops; Flags: ignoreversion' print ofi, r'Source: prog\data\buttons\*; DestDir: {app}\prog\data\buttons; Flags: ignoreversion' print ofi, r'Source: prog\data\fonts\*; DestDir: {app}\prog\data\fonts; Flags: ignoreversion' print ofi, r'Source: prog\data\icons\*; DestDir: {app}\prog\data\icons; Flags: ignoreversion' print ofi, r'Source: prog\data\music\*; DestDir: {app}\prog\data\music; Flags: ignoreversion' print ofi, r'Source: prog\data\sounds\*; DestDir: {app}\prog\data\sounds; Flags: ignoreversion' print ofi, r'Source: prog\data\trouble\*; DestDir: {app}\prog\data\trouble; Flags: ignoreversion' print ofi, r'Source: prog\msvcr71.dll; DestDir: {app}\prog; Flags: ignoreversion' #print ofi, r'Source: prog\libpng12-0.dll; DestDir: {app}\prog; Flags: ignoreversion' #print ofi, r'Source: prog\jpeg.dll; DestDir: {app}\prog; Flags: ignoreversion' #print ofi, r'Source: prog\libvorbisfile-3.dll; DestDir: {app}\prog; Flags: ignoreversion' #print ofi, r'Source: prog\libogg-0.dll; DestDir: {app}\prog; Flags: ignoreversion' #print ofi, r'Source: prog\libvorbis-0.dll; DestDir: {app}\prog; Flags:
Re: [pygame] mixer.music in runtime
Hey Keith, is the bundle that you built that fails for you available somewhere for others to test and play with? Also, like I mentioned earlier in this thread, pygame is swallowing the exception that occurred when it tried to import the mixer_music module and bind it to the mixer module as pygame.mixer.music - you can expose the original error if you: -- import pygame.mixer_music - before trying to access pygame.mixer.music. The traceback for that import should be helpful. On Tue, May 20, 2008 at 10:08 AM, Keith Nemitz [EMAIL PROTECTED] wrote: I'm having the same trouble. Unfortunately for me, all of the suggested remedies failed. If I build the game with 1.7 pygame.mixer.music works. Under 1.8 I get the message: AttributeError: 'module' object has no attribute 'music' I tried using py2exe 0.6.6 and 0.6.5. I have XP SP2. Fails in Parallels and VMWare: Fusion. Don't have a 'real' pc anymore. Has anyone investigated this further? Here is my build file and the relevant part of my audio.py # A setup script showing how to extend py2exe. # # In this case, the py2exe command is subclassed to create an installation # script for InnoSetup, which can be compiled with the InnoSetup compiler # to a single file windows installer. # # By default, the installer will be created as dist\Output\setup.exe. from distutils.core import setup import py2exe import sys import shutil # arguments for the setup() call brigiton = dict( script = main.py, dest_base = rprog\brigiton, icon_resources = [(1,DHSGiT.ico)]) zipfile = rlib\shardlib options = {py2exe: {compressed: 0, optimize: 2}, } #dataList = []; #glob.glob(data\\*); #scan data folder for files and append in form data\file import os class InnoScript: def __init__(self, name, lib_dir, dist_dir, windows_exe_files = [], lib_files = [], data_files = [], version = 1.0.2.0): #another one down below. self.lib_dir = lib_dir self.dist_dir = dist_dir if not self.dist_dir[-1] in \\/: self.dist_dir += \\ self.name = name self.version = version self.windows_exe_files = [self.chop(p) for p in windows_exe_files] self.lib_files = [self.chop(p) for p in lib_files] def chop(self, pathname): assert pathname.startswith(self.dist_dir) return pathname[len(self.dist_dir):] def create(self, pathname=dist\\brigiton.iss): self.pathname = pathname ofi = self.file = open(pathname, w) print ofi, ; WARNING: This script has been created by py2exe. Changes to this script print ofi, ; will be overwritten the next time py2exe is run! print ofi, r[Setup] print ofi, rAppName=%s % self.name print ofi, rAppVerName=%s %s % (self.name, self.version) print ofi, rDefaultDirName={pf}\%s % self.name print ofi, rDefaultGroupName=%s % self.name print ofi print ofi, r[Dirs] print ofi, r'Name: {app}\prog\data' print ofi, r'Name: {app}\prog\data\actors' #print ofi, r'Name: {app}\prog\data\anims' print ofi, r'Name: {app}\prog\data\animations' print ofi, r'Name: {app}\prog\data\backdrops' print ofi, r'Name: {app}\prog\data\buttons' print ofi, r'Name: {app}\prog\data\fonts' print ofi, r'Name: {app}\prog\data\icons' print ofi, r'Name: {app}\prog\data\music' print ofi, r'Name: {app}\prog\data\sounds' print ofi, r'Name: {app}\prog\data\trouble' print ofi print ofi, r[Files] #print ofi, r'Source: prog\data\*; DestDir: {app}\prog\data; Flags: ignoreversion' print ofi, r'Source: prog\data\actors\*; DestDir: {app}\prog\data\actors; Flags: ignoreversion' #print ofi, r'Source: prog\data\anims\*; DestDir: {app}\prog\data\anims; Flags: ignoreversion' print ofi, r'Source: prog\data\animations\*; DestDir: {app}\prog\data\animations; Flags: ignoreversion' print ofi, r'Source: prog\data\backdrops\*; DestDir: {app}\prog\data\backdrops; Flags: ignoreversion' print ofi, r'Source: prog\data\buttons\*; DestDir: {app}\prog\data\buttons; Flags: ignoreversion' print ofi, r'Source: prog\data\fonts\*; DestDir: {app}\prog\data\fonts; Flags: ignoreversion' print ofi, r'Source: prog\data\icons\*; DestDir: {app}\prog\data\icons; Flags: ignoreversion' print ofi, r'Source: prog\data\music\*; DestDir: {app}\prog\data\music; Flags: ignoreversion' print ofi, r'Source: prog\data\sounds\*; DestDir: {app}\prog\data\sounds; Flags: ignoreversion' print ofi, r'Source: prog\data\trouble\*;
Re: [pygame] mixer.music in runtime
Brian, I put your import line right above the failing line, but got exactly the same results. I even removed the try/exception block. I will try to make a minimal build that exhibits the problem. Don't know how long that'll take. --- Brian Fisher [EMAIL PROTECTED] wrote: Hey Keith, is the bundle that you built that fails for you available somewhere for others to test and play with? Also, like I mentioned earlier in this thread, pygame is swallowing the exception that occurred when it tried to import the mixer_music module and bind it to the mixer module as pygame.mixer.music - you can expose the original error if you: -- import pygame.mixer_music - before trying to access pygame.mixer.music. The traceback for that import should be helpful. On Tue, May 20, 2008 at 10:08 AM, Keith Nemitz [EMAIL PROTECTED] wrote: I'm having the same trouble. Unfortunately for me, all of the suggested remedies failed. If I build the game with 1.7 pygame.mixer.music works. Under 1.8 I get the message: AttributeError: 'module' object has no attribute 'music' I tried using py2exe 0.6.6 and 0.6.5. I have XP SP2. Fails in Parallels and VMWare: Fusion. Don't have a 'real' pc anymore. Has anyone investigated this further? Here is my build file and the relevant part of my audio.py # A setup script showing how to extend py2exe. # # In this case, the py2exe command is subclassed to create an installation # script for InnoSetup, which can be compiled with the InnoSetup compiler # to a single file windows installer. # # By default, the installer will be created as dist\Output\setup.exe. from distutils.core import setup import py2exe import sys import shutil # arguments for the setup() call brigiton = dict( script = main.py, dest_base = rprog\brigiton, icon_resources = [(1,DHSGiT.ico)]) zipfile = rlib\shardlib options = {py2exe: {compressed: 0, optimize: 2}, } #dataList = []; #glob.glob(data\\*); #scan data folder for files and append in form data\file import os class InnoScript: def __init__(self, name, lib_dir, dist_dir, windows_exe_files = [], lib_files = [], data_files = [], version = 1.0.2.0): #another one down below. self.lib_dir = lib_dir self.dist_dir = dist_dir if not self.dist_dir[-1] in \\/: self.dist_dir += \\ self.name = name self.version = version self.windows_exe_files = [self.chop(p) for p in windows_exe_files] self.lib_files = [self.chop(p) for p in lib_files] def chop(self, pathname): assert pathname.startswith(self.dist_dir) return pathname[len(self.dist_dir):] def create(self, pathname=dist\\brigiton.iss): self.pathname = pathname ofi = self.file = open(pathname, w) print ofi, ; WARNING: This script has been created by py2exe. Changes to this script print ofi, ; will be overwritten the next time py2exe is run! print ofi, r[Setup] print ofi, rAppName=%s % self.name print ofi, rAppVerName=%s %s % (self.name, self.version) print ofi, rDefaultDirName={pf}\%s % self.name print ofi, rDefaultGroupName=%s % self.name print ofi print ofi, r[Dirs] print ofi, r'Name: {app}\prog\data' print ofi, r'Name: {app}\prog\data\actors' #print ofi, r'Name: {app}\prog\data\anims' print ofi, r'Name: {app}\prog\data\animations' print ofi, r'Name: {app}\prog\data\backdrops' print ofi, r'Name: {app}\prog\data\buttons' print ofi, r'Name: {app}\prog\data\fonts' print ofi, r'Name: {app}\prog\data\icons' print ofi, r'Name: {app}\prog\data\music' print ofi, r'Name: {app}\prog\data\sounds' print ofi, r'Name: {app}\prog\data\trouble' print ofi print ofi, r[Files] #print ofi, r'Source: prog\data\*; DestDir: {app}\prog\data; Flags: ignoreversion' print ofi, r'Source: prog\data\actors\*; DestDir: {app}\prog\data\actors; Flags: ignoreversion' #print ofi, r'Source: prog\data\anims\*; DestDir: {app}\prog\data\anims; Flags: ignoreversion' print ofi, r'Source: prog\data\animations\*; DestDir: {app}\prog\data\animations; Flags: ignoreversion' print ofi, r'Source: prog\data\backdrops\*; DestDir: {app}\prog\data\backdrops; Flags: ignoreversion' print ofi, r'Source: prog\data\buttons\*; DestDir: {app}\prog\data\buttons; Flags: ignoreversion' print ofi, r'Source: prog\data\fonts\*; DestDir:
Re: [pygame] mixer.music in runtime
I guess that means it imports correctly, but somehow fails to get bound? I don't suppose you can access the functionality you need through mixer_music, can you? In other words, what happens if you change the first failing pygame.mixer.music.whatever line to pygame.mixer_music.whatever? (after the import, of course) On Tue, May 20, 2008 at 11:17 AM, Keith Nemitz [EMAIL PROTECTED] wrote: I put your import line right above the failing line, but got exactly the same results. I even removed the try/exception block.
Re: [pygame] mixer.music in runtime
Yep, It's in Program Files/(AppFolder)/lib. --- René Dudfield [EMAIL PROTECTED] wrote: hi, Do you have the smpeg dll copied in there? cu, On Wed, May 21, 2008 at 7:58 AM, Keith Nemitz [EMAIL PROTECTED] wrote: I get the following: AttributeError: 'module' object has no attribute 'mixer_music' --- Brian Fisher [EMAIL PROTECTED] wrote: I guess that means it imports correctly, but somehow fails to get bound? I don't suppose you can access the functionality you need through mixer_music, can you? In other words, what happens if you change the first failing pygame.mixer.music.whatever line to pygame.mixer_music.whatever? (after the import, of course) On Tue, May 20, 2008 at 11:17 AM, Keith Nemitz [EMAIL PROTECTED] wrote: I put your import line right above the failing line, but got exactly the same results. I even removed the try/exception block.
Re: [pygame] mixer.music in runtime
ah, Have you tried uninstalling (maybe manually deleting) pygame, py2exe etc then installing again? Maybe there's some problem with that... On Wed, May 21, 2008 at 9:31 AM, Keith Nemitz [EMAIL PROTECTED] wrote: Yep, It's in Program Files/(AppFolder)/lib. --- René Dudfield [EMAIL PROTECTED] wrote: hi, Do you have the smpeg dll copied in there? cu, On Wed, May 21, 2008 at 7:58 AM, Keith Nemitz [EMAIL PROTECTED] wrote: I get the following: AttributeError: 'module' object has no attribute 'mixer_music' --- Brian Fisher [EMAIL PROTECTED] wrote: I guess that means it imports correctly, but somehow fails to get bound? I don't suppose you can access the functionality you need through mixer_music, can you? In other words, what happens if you change the first failing pygame.mixer.music.whatever line to pygame.mixer_music.whatever? (after the import, of course) On Tue, May 20, 2008 at 11:17 AM, Keith Nemitz [EMAIL PROTECTED] wrote: I put your import line right above the failing line, but got exactly the same results. I even removed the try/exception block.
Re: [pygame] mixer.music in runtime
I've started with fresh XP Sp2 installs on both VMWare and Parallels. Installed only what was necessary: Python, pygame, numeric, py2exe. As per earlier suggestion, I uninstalled py2exe 0.6.6 and installed 0.6.5. I don't think it's an install issue. --- René Dudfield [EMAIL PROTECTED] wrote: ah, Have you tried uninstalling (maybe manually deleting) pygame, py2exe etc then installing again? Maybe there's some problem with that... On Wed, May 21, 2008 at 9:31 AM, Keith Nemitz [EMAIL PROTECTED] wrote: Yep, It's in Program Files/(AppFolder)/lib. --- René Dudfield [EMAIL PROTECTED] wrote: hi, Do you have the smpeg dll copied in there? cu, On Wed, May 21, 2008 at 7:58 AM, Keith Nemitz [EMAIL PROTECTED] wrote: I get the following: AttributeError: 'module' object has no attribute 'mixer_music' --- Brian Fisher [EMAIL PROTECTED] wrote: I guess that means it imports correctly, but somehow fails to get bound? I don't suppose you can access the functionality you need through mixer_music, can you? In other words, what happens if you change the first failing pygame.mixer.music.whatever line to pygame.mixer_music.whatever? (after the import, of course) On Tue, May 20, 2008 at 11:17 AM, Keith Nemitz [EMAIL PROTECTED] wrote: I put your import line right above the failing line, but got exactly the same results. I even removed the try/exception block.
Re: [pygame] mixer.music in runtime
hrmm, Could you try adding... --includes=pygame.mixer_music includes = ['pygame.mixer_music'] or --includes=pygame.mixer.music includes = ['pygame.mixer.music'] Or failing that... a work around might be to exclude it, and copy it in manually. eg. --excludes=pygame copytree(PYGAME_DIR, DISTRIBUTION_DIR) On Wed, May 21, 2008 at 10:17 AM, Keith Nemitz [EMAIL PROTECTED] wrote: I've started with fresh XP Sp2 installs on both VMWare and Parallels. Installed only what was necessary: Python, pygame, numeric, py2exe. As per earlier suggestion, I uninstalled py2exe 0.6.6 and installed 0.6.5. I don't think it's an install issue. --- René Dudfield [EMAIL PROTECTED] wrote: ah, Have you tried uninstalling (maybe manually deleting) pygame, py2exe etc then installing again? Maybe there's some problem with that... On Wed, May 21, 2008 at 9:31 AM, Keith Nemitz [EMAIL PROTECTED] wrote: Yep, It's in Program Files/(AppFolder)/lib. --- René Dudfield [EMAIL PROTECTED] wrote: hi, Do you have the smpeg dll copied in there? cu, On Wed, May 21, 2008 at 7:58 AM, Keith Nemitz [EMAIL PROTECTED] wrote: I get the following: AttributeError: 'module' object has no attribute 'mixer_music' --- Brian Fisher [EMAIL PROTECTED] wrote: I guess that means it imports correctly, but somehow fails to get bound? I don't suppose you can access the functionality you need through mixer_music, can you? In other words, what happens if you change the first failing pygame.mixer.music.whatever line to pygame.mixer_music.whatever? (after the import, of course) On Tue, May 20, 2008 at 11:17 AM, Keith Nemitz [EMAIL PROTECTED] wrote: I put your import line right above the failing line, but got exactly the same results. I even removed the try/exception block.
Re: [pygame] mixer.music in runtime
I've uploaded a minimal app that has the problem. http://p4.hostingprod.com/@mousechief.com/musicFailSetup.exe Here's the two relevant files: - audio py import pygame,os musicNames = []; #soundNames = [sangria,sonar,drop,badswap,chaching,wall]; soundNames = []; soundLib = {}; mixer = music = None; #Hogari_Hisaaki-Yasuko_Yamano-Beagle.ogg nextMusic = 0; musicVolume = 1.0; #0.4; musicFlag = True; lastSound = ; lastSndTime = 0; loopSound = None; def InitSounds(): global mixer, music, musicNames; #try: import pygame.mixer as pymix mixer = pymix; import pygame.mixer_music music = pymix.music; #except (ImportError, pygame.error): #return; tp = os.path.join('data','music'); tl = os.listdir(tp); for fname in tl: if (fname[-4] == '.'): musicNames.append(fname); music.set_volume(musicVolume); PlayMusic(); while music.get_busy(): pass pass def PlayMusic(name, loopCount=1): if (not music or not musicFlag): return; #check music loop preference if loop: loop = -1; loop = loopCount; if music.get_busy(): #we really should fade out nicely and #wait for the end music event, for now, CUT music.stop(); fullname = os.path.join('data', 'music', name); if (os.access(fullname,os.F_OK)): music.load(fullname); else: fullname = os.path.join('data', 'sounds', name); music.load(fullname); music.play(loop); return; - setup.py # A setup script showing how to extend py2exe. # # In this case, the py2exe command is subclassed to create an installation # script for InnoSetup, which can be compiled with the InnoSetup compiler # to a single file windows installer. # # By default, the installer will be created as dist\Output\setup.exe. from distutils.core import setup import py2exe import sys import shutil # arguments for the setup() call brigiton = dict( script = main.py, dest_base = rprog\brigiton, icon_resources = [(1,DHSGiT.ico)]) zipfile = rlib\shardlib options = {py2exe: {compressed: 0, optimize: 2}, } #dataList = []; #glob.glob(data\\*); #scan data folder for files and append in form data\file import os class InnoScript: def __init__(self, name, lib_dir, dist_dir, windows_exe_files = [], lib_files = [], data_files = [], version = 1.0.2.0): #another one down below. self.lib_dir = lib_dir self.dist_dir = dist_dir if not self.dist_dir[-1] in \\/: self.dist_dir += \\ self.name = name self.version = version self.windows_exe_files = [self.chop(p) for p in windows_exe_files] self.lib_files = [self.chop(p) for p in lib_files] def chop(self, pathname): assert pathname.startswith(self.dist_dir) return pathname[len(self.dist_dir):] def create(self, pathname=dist\\brigiton.iss): self.pathname = pathname ofi = self.file = open(pathname, w) print ofi, ; WARNING: This script has been created by py2exe. Changes to this script print ofi, ; will be overwritten the next time py2exe is run! print ofi, r[Setup] print ofi, rAppName=%s % self.name print ofi, rAppVerName=%s %s % (self.name, self.version) print ofi, rDefaultDirName={pf}\%s % self.name print ofi, rDefaultGroupName=%s % self.name print ofi print ofi, r[Dirs] print ofi, r'Name: {app}\prog\data' print ofi, r'Name: {app}\prog\data\music' print ofi print ofi, r[Files] print ofi, r'Source: prog\data\music\*; DestDir: {app}\prog\data\music; Flags: ignoreversion' print ofi, r'Source: prog\msvcr71.dll; DestDir: {app}\prog; Flags: ignoreversion' #print ofi, r'Source: prog\libpng12-0.dll; DestDir: {app}\prog; Flags: ignoreversion' #print ofi, r'Source: prog\jpeg.dll; DestDir: {app}\prog; Flags: ignoreversion' #print ofi, r'Source: prog\libvorbisfile-3.dll; DestDir: {app}\prog; Flags: ignoreversion' #print ofi, r'Source: prog\libogg-0.dll; DestDir: {app}\prog; Flags: ignoreversion' #print ofi, r'Source: prog\libvorbis-0.dll; DestDir: {app}\prog; Flags: ignoreversion' print ofi, r'Source: prog\libfreetype-6.dll; DestDir: {app}\lib; Flags: ignoreversion' #print ofi, r'Source: prog\zlib1.dll; DestDir: {app}\lib; Flags: ignoreversion' for path in self.windows_exe_files + self.lib_files: print ofi, r'Source: %s; DestDir: {app}\%s; Flags: ignoreversion' % (path, os.path.dirname(path))
Re: [pygame] mixer.music in runtime
hey, thanks... I'm not near a windows machine at the moment... so I can't test. Strangely the py2exe stuff works for me. However... what I meant before to try would be this... in your setup. excludes = [] includes = [pygame.mixer.music, pygame.mixer_music, pygame] opts = { py2exe: { includes:includes, excludes:excludes } } setup(... options=opts ) On Wed, May 21, 2008 at 10:44 AM, Keith Nemitz [EMAIL PROTECTED] wrote: I've uploaded a minimal app that has the problem. http://p4.hostingprod.com/@mousechief.com/musicFailSetup.exe Here's the two relevant files: - audio py import pygame,os musicNames = []; #soundNames = [sangria,sonar,drop,badswap,chaching,wall]; soundNames = []; soundLib = {}; mixer = music = None; #Hogari_Hisaaki-Yasuko_Yamano-Beagle.ogg nextMusic = 0; musicVolume = 1.0; #0.4; musicFlag = True; lastSound = ; lastSndTime = 0; loopSound = None; def InitSounds(): global mixer, music, musicNames; #try: import pygame.mixer as pymix mixer = pymix; import pygame.mixer_music music = pymix.music; #except (ImportError, pygame.error): #return; tp = os.path.join('data','music'); tl = os.listdir(tp); for fname in tl: if (fname[-4] == '.'): musicNames.append(fname); music.set_volume(musicVolume); PlayMusic(); while music.get_busy(): pass pass def PlayMusic(name, loopCount=1): if (not music or not musicFlag): return; #check music loop preference if loop: loop = -1; loop = loopCount; if music.get_busy(): #we really should fade out nicely and #wait for the end music event, for now, CUT music.stop(); fullname = os.path.join('data', 'music', name); if (os.access(fullname,os.F_OK)): music.load(fullname); else: fullname = os.path.join('data', 'sounds', name); music.load(fullname); music.play(loop); return; - setup.py # A setup script showing how to extend py2exe. # # In this case, the py2exe command is subclassed to create an installation # script for InnoSetup, which can be compiled with the InnoSetup compiler # to a single file windows installer. # # By default, the installer will be created as dist\Output\setup.exe. from distutils.core import setup import py2exe import sys import shutil # arguments for the setup() call brigiton = dict( script = main.py, dest_base = rprog\brigiton, icon_resources = [(1,DHSGiT.ico)]) zipfile = rlib\shardlib options = {py2exe: {compressed: 0, optimize: 2}, } #dataList = []; #glob.glob(data\\*); #scan data folder for files and append in form data\file import os class InnoScript: def __init__(self, name, lib_dir, dist_dir, windows_exe_files = [], lib_files = [], data_files = [], version = 1.0.2.0): #another one down below. self.lib_dir = lib_dir self.dist_dir = dist_dir if not self.dist_dir[-1] in \\/: self.dist_dir += \\ self.name = name self.version = version self.windows_exe_files = [self.chop(p) for p in windows_exe_files] self.lib_files = [self.chop(p) for p in lib_files] def chop(self, pathname): assert pathname.startswith(self.dist_dir) return pathname[len(self.dist_dir):] def create(self, pathname=dist\\brigiton.iss): self.pathname = pathname ofi = self.file = open(pathname, w) print ofi, ; WARNING: This script has been created by py2exe. Changes to this script print ofi, ; will be overwritten the next time py2exe is run! print ofi, r[Setup] print ofi, rAppName=%s % self.name print ofi, rAppVerName=%s %s % (self.name, self.version) print ofi, rDefaultDirName={pf}\%s % self.name print ofi, rDefaultGroupName=%s % self.name print ofi print ofi, r[Dirs] print ofi, r'Name: {app}\prog\data' print ofi, r'Name: {app}\prog\data\music' print ofi print ofi, r[Files] print ofi, r'Source: prog\data\music\*; DestDir: {app}\prog\data\music; Flags: ignoreversion' print ofi, r'Source: prog\msvcr71.dll; DestDir: {app}\prog; Flags: ignoreversion' #print ofi, r'Source: prog\libpng12-0.dll; DestDir: {app}\prog; Flags: ignoreversion' #print ofi, r'Source: prog\jpeg.dll; DestDir: {app}\prog; Flags: ignoreversion' #print ofi, r'Source: prog\libvorbisfile-3.dll; DestDir: {app}\prog; Flags: ignoreversion' #print ofi, r'Source: prog\libogg-0.dll; DestDir:
Re: [pygame] mixer.music in runtime
Hey, I'm working on a game and just set up a fresh dev environment. I found that I was having the same issues with py2exe and pygame. Since (as I'll post in a minute) I was having issues with pygame-1.8's sound, I downgraded to 1.7 to fix that. However, the py2exe issues persisted. I checked on one of my other systems and saw that I was using py2exe 0.6.5 on those systems. By downgrading to py2exe 0.6.5, I was able to resolve the mixer issue. So my conclusion is - somehow py2exe 0.6.6 doesn't like pygame (1.7 or 1.8). Hope that helps! -Phil René Dudfield [EMAIL PROTECTED] wrote: ah, yeah. smpeg wasn't in 1.7.1 on windows... but now it is. So, yeah, that's most likely the problem. On Thu, Apr 3, 2008 at 9:33 AM, Lenard Lindstrom wrote: Pygame 1.8 does have more dependencies than 1.7. It's been awhile since I used 1.7 but are not smpeg new to Windows. And are not libvorbis and libogg new to 1.8? Could py2exe be overlooking them? Lenard René Dudfield wrote: Can you tell py2exe to include the pygame.music_mixer or mixer_music.pyd module specifically? On Wed, Apr 2, 2008 at 9:13 PM, Bo Jangeborg wrote: More info on mixer.music It works in the pygame 1.7 so looks like we have a bug in 1.8. Bo Jangeborg skrev: Hi I am trying to run pygame.mixer.music after having created a py2exe. The import seem to work ok, but it never loads the music method so the following doesn't work import pygame.mixer print pygame.mixer.music Traceback (most recent call last): File test.pyw, line 728, in File test.pyw, line 128, in main File vers_01\Program\Test\testgame.pyw, line 66, in run File vers_01\Program\Test\testgame.pyw, line 147, in __init__ File vers_01\Program\Test\testgame.pyw, line 158, in initiate_music File vers_01\Program\TestMusic\__init__.py, line 1, in File vers_01\Program\TestMusic\musix.pyw, line 11, in AttributeError: 'module' object has no attribute 'music' In the developer version it works and the print returns : Files\Python2_5\Lib\site-packages\pygame\mixer_music.pyd' What could I be doing wrong ? - You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost.
Re: [pygame] mixer.music in runtime
More info on mixer.music It works in the pygame 1.7 so looks like we have a bug in 1.8. Bo Jangeborg skrev: Hi I am trying to run pygame.mixer.music after having created a py2exe. The import seem to work ok, but it never loads the music method so the following doesn't work import pygame.mixer print pygame.mixer.music Traceback (most recent call last): File test.pyw, line 728, in module File test.pyw, line 128, in main File vers_01\Program\Test\testgame.pyw, line 66, in run File vers_01\Program\Test\testgame.pyw, line 147, in __init__ File vers_01\Program\Test\testgame.pyw, line 158, in initiate_music File vers_01\Program\TestMusic\__init__.py, line 1, in module File vers_01\Program\TestMusic\musix.pyw, line 11, in module AttributeError: 'module' object has no attribute 'music' In the developer version it works and the print returns : module 'pygame.mixer_music' from 'C:\Program Files\Python2_5\Lib\site-packages\pygame\mixer_music.pyd' What could I be doing wrong ?
Re: [pygame] mixer.music in runtime
Can you tell py2exe to include the pygame.music_mixer or mixer_music.pyd module specifically? On Wed, Apr 2, 2008 at 9:13 PM, Bo Jangeborg [EMAIL PROTECTED] wrote: More info on mixer.music It works in the pygame 1.7 so looks like we have a bug in 1.8. Bo Jangeborg skrev: Hi I am trying to run pygame.mixer.music after having created a py2exe. The import seem to work ok, but it never loads the music method so the following doesn't work import pygame.mixer print pygame.mixer.music Traceback (most recent call last): File test.pyw, line 728, in module File test.pyw, line 128, in main File vers_01\Program\Test\testgame.pyw, line 66, in run File vers_01\Program\Test\testgame.pyw, line 147, in __init__ File vers_01\Program\Test\testgame.pyw, line 158, in initiate_music File vers_01\Program\TestMusic\__init__.py, line 1, in module File vers_01\Program\TestMusic\musix.pyw, line 11, in module AttributeError: 'module' object has no attribute 'music' In the developer version it works and the print returns : module 'pygame.mixer_music' from 'C:\Program Files\Python2_5\Lib\site-packages\pygame\mixer_music.pyd' What could I be doing wrong ?
Re: [pygame] mixer.music in runtime
Pygame 1.8 does have more dependencies than 1.7. It's been awhile since I used 1.7 but are not smpeg new to Windows. And are not libvorbis and libogg new to 1.8? Could py2exe be overlooking them? Lenard René Dudfield wrote: Can you tell py2exe to include the pygame.music_mixer or mixer_music.pyd module specifically? On Wed, Apr 2, 2008 at 9:13 PM, Bo Jangeborg [EMAIL PROTECTED] wrote: More info on mixer.music It works in the pygame 1.7 so looks like we have a bug in 1.8. Bo Jangeborg skrev: Hi I am trying to run pygame.mixer.music after having created a py2exe. The import seem to work ok, but it never loads the music method so the following doesn't work import pygame.mixer print pygame.mixer.music Traceback (most recent call last): File test.pyw, line 728, in module File test.pyw, line 128, in main File vers_01\Program\Test\testgame.pyw, line 66, in run File vers_01\Program\Test\testgame.pyw, line 147, in __init__ File vers_01\Program\Test\testgame.pyw, line 158, in initiate_music File vers_01\Program\TestMusic\__init__.py, line 1, in module File vers_01\Program\TestMusic\musix.pyw, line 11, in module AttributeError: 'module' object has no attribute 'music' In the developer version it works and the print returns : module 'pygame.mixer_music' from 'C:\Program Files\Python2_5\Lib\site-packages\pygame\mixer_music.pyd' What could I be doing wrong ?
Re: [pygame] mixer.music in runtime
ah, yeah. smpeg wasn't in 1.7.1 on windows... but now it is. So, yeah, that's most likely the problem. On Thu, Apr 3, 2008 at 9:33 AM, Lenard Lindstrom [EMAIL PROTECTED] wrote: Pygame 1.8 does have more dependencies than 1.7. It's been awhile since I used 1.7 but are not smpeg new to Windows. And are not libvorbis and libogg new to 1.8? Could py2exe be overlooking them? Lenard René Dudfield wrote: Can you tell py2exe to include the pygame.music_mixer or mixer_music.pyd module specifically? On Wed, Apr 2, 2008 at 9:13 PM, Bo Jangeborg [EMAIL PROTECTED] wrote: More info on mixer.music It works in the pygame 1.7 so looks like we have a bug in 1.8. Bo Jangeborg skrev: Hi I am trying to run pygame.mixer.music after having created a py2exe. The import seem to work ok, but it never loads the music method so the following doesn't work import pygame.mixer print pygame.mixer.music Traceback (most recent call last): File test.pyw, line 728, in module File test.pyw, line 128, in main File vers_01\Program\Test\testgame.pyw, line 66, in run File vers_01\Program\Test\testgame.pyw, line 147, in __init__ File vers_01\Program\Test\testgame.pyw, line 158, in initiate_music File vers_01\Program\TestMusic\__init__.py, line 1, in module File vers_01\Program\TestMusic\musix.pyw, line 11, in module AttributeError: 'module' object has no attribute 'music' In the developer version it works and the print returns : module 'pygame.mixer_music' from 'C:\Program Files\Python2_5\Lib\site-packages\pygame\mixer_music.pyd' What could I be doing wrong ?
Re: [pygame] mixer.music in runtime
The following are included in the main directory where the other dll's are: smpeg.dll libogg-0.dll libvorbis-0.dll libvorbisfile-3.dll libogg-0.dll mixer_music.pyd So py2exe didn't miss any as far as I can see. Since no error is thrown on import is there any other conditions that are triggered to make it not import the mixer_music ? Have you tried it yourself's ? René Dudfield skrev: ah, yeah. smpeg wasn't in 1.7.1 on windows... but now it is. So, yeah, that's most likely the problem. On Thu, Apr 3, 2008 at 9:33 AM, Lenard Lindstrom [EMAIL PROTECTED] wrote: Pygame 1.8 does have more dependencies than 1.7. It's been awhile since I used 1.7 but are not smpeg new to Windows. And are not libvorbis and libogg new to 1.8? Could py2exe be overlooking them? Lenard René Dudfield wrote: Can you tell py2exe to include the pygame.music_mixer or mixer_music.pyd module specifically? On Wed, Apr 2, 2008 at 9:13 PM, Bo Jangeborg [EMAIL PROTECTED] wrote: More info on mixer.music It works in the pygame 1.7 so looks like we have a bug in 1.8. Bo Jangeborg skrev: Hi I am trying to run pygame.mixer.music after having created a py2exe. The import seem to work ok, but it never loads the music method so the following doesn't work import pygame.mixer print pygame.mixer.music Traceback (most recent call last): File test.pyw, line 728, in module File test.pyw, line 128, in main File vers_01\Program\Test\testgame.pyw, line 66, in run File vers_01\Program\Test\testgame.pyw, line 147, in __init__ File vers_01\Program\Test\testgame.pyw, line 158, in initiate_music File vers_01\Program\TestMusic\__init__.py, line 1, in module File vers_01\Program\TestMusic\musix.pyw, line 11, in module AttributeError: 'module' object has no attribute 'music' In the developer version it works and the print returns : module 'pygame.mixer_music' from 'C:\Program Files\Python2_5\Lib\site-packages\pygame\mixer_music.pyd' What could I be doing wrong ?
Re: [pygame] mixer.music in runtime
hi again, have you got a link to your code we could download? Also the command you are using to build it would be nice. cheers, On Thu, Apr 3, 2008 at 10:16 AM, Bo Jangeborg [EMAIL PROTECTED] wrote: The following are included in the main directory where the other dll's are: smpeg.dll libogg-0.dll libvorbis-0.dll libvorbisfile-3.dll libogg-0.dll mixer_music.pyd So py2exe didn't miss any as far as I can see. Since no error is thrown on import is there any other conditions that are triggered to make it not import the mixer_music ? Have you tried it yourself's ? René Dudfield skrev: ah, yeah. smpeg wasn't in 1.7.1 on windows... but now it is. So, yeah, that's most likely the problem. On Thu, Apr 3, 2008 at 9:33 AM, Lenard Lindstrom [EMAIL PROTECTED] wrote: Pygame 1.8 does have more dependencies than 1.7. It's been awhile since I used 1.7 but are not smpeg new to Windows. And are not libvorbis and libogg new to 1.8? Could py2exe be overlooking them? Lenard René Dudfield wrote: Can you tell py2exe to include the pygame.music_mixer or mixer_music.pyd module specifically? On Wed, Apr 2, 2008 at 9:13 PM, Bo Jangeborg [EMAIL PROTECTED] wrote: More info on mixer.music It works in the pygame 1.7 so looks like we have a bug in 1.8. Bo Jangeborg skrev: Hi I am trying to run pygame.mixer.music after having created a py2exe. The import seem to work ok, but it never loads the music method so the following doesn't work import pygame.mixer print pygame.mixer.music Traceback (most recent call last): File test.pyw, line 728, in module File test.pyw, line 128, in main File vers_01\Program\Test\testgame.pyw, line 66, in run File vers_01\Program\Test\testgame.pyw, line 147, in __init__ File vers_01\Program\Test\testgame.pyw, line 158, in initiate_music File vers_01\Program\TestMusic\__init__.py, line 1, in module File vers_01\Program\TestMusic\musix.pyw, line 11, in module AttributeError: 'module' object has no attribute 'music' In the developer version it works and the print returns : module 'pygame.mixer_music' from 'C:\Program Files\Python2_5\Lib\site-packages\pygame\mixer_music.pyd' What could I be doing wrong ?
Re: [pygame] mixer.music in runtime
On Wed, Apr 2, 2008 at 4:16 PM, Bo Jangeborg [EMAIL PROTECTED] wrote: Since no error is thrown on import is there any other conditions that are triggered to make it not import the mixer_music ? The source for mixer calls PyImport_ImportModule for pygame.mixer_music and then explicitly swallows the exception if that fails maybe you could try: import pygame.mixer_music yourself, and see the exception?