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 = r"prog\brigiton", > icon_resources = [(1,"DHSGiT.ico")]) > > zipfile = r"lib\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, r"AppName=%s" % self.name > print >> ofi, r"AppVerName=%s %s" % (self.name, self.version) > print >> ofi, r"DefaultDirName={pf}\%s" % self.name > print >> ofi, r"DefaultGroupName=%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: > 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)) > print >> ofi > > print >> ofi, r"[Icons]" > for path in self.windows_exe_files: > print >> ofi, r'Name: "{group}\%s"; Filename: "{app}\%s"' % \ > (self.name, path) > print >> ofi, 'Name: "{group}\Uninstall %s"; Filename: > "{uninstallexe}"' % self.name > > def compile(self): > try: > import ctypes > except ImportError: > try: > import win32api > except ImportError: > import os > os.startfile(self.pathname) > else: > print "Ok, using win32api." > win32api.ShellExecute(0, "compile", > self.pathname, > None, > None, > 0) > else: > print "Cool, you have ctypes installed." > res = ctypes.windll.shell32.ShellExecuteA(0, "compile", > self.pathname, > None, > None, > 0) > if res < 32: > raise RuntimeError, "ShellExecute failed, error %d" % res > > > ################################################################ > > from py2exe.build_exe import py2exe > > class build_installer(py2exe): > # This class first builds the exe file(s), then creates a Windows > installer. > # You need InnoSetup for it. > def run(self): > # First, let py2exe do it's work. > py2exe.run(self) > > lib_dir = self.lib_dir > dist_dir = self.dist_dir > > # create the Installer, using the files py2exe has created. > script = InnoScript("DangerousHSGirls", > lib_dir, > dist_dir, > self.windows_exe_files, > self.lib_files) > print "*** creating the inno setup script***" > script.create() > print "*** compiling the inno setup script***" > script.compile() > # Note: By default the final setup.exe will be in an Output > subdirectory. > > ################################################################ > > setup( > options = options, > version = "1.0.2.0", #last digit for Windows increments between Mac > increments > description = "py2exe script", > name = "Dangerous HS Girls in Trouble!", > > # The lib directory contains everything except the executables and the > python dll. > zipfile = zipfile, > windows = [brigiton], > # use out build_installer class as extended py2exe build command > cmdclass = {"py2exe": build_installer}, > #data_files = [("prog\data", [])], > ) > > > ------------------------------------------------------------- audio.py > > > import pygame,os > import faceEngn > import pygame.mixer_music > > 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; > music = pymix.music; #<<<<<<<<< FAILS HERE!!!!! > 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); > pass > > > > > --- René Dudfield <[EMAIL PROTECTED]> wrote: > > > hi, > > > > did you try and import pygame.mixer_music to see the traceback? > > > > As Brian has said it works for him with those versions, so he can't > > try it himself. > > > > cheers, > > > > > > > > On Sun, Apr 6, 2008 at 4:49 AM, Phil Hassey <[EMAIL PROTECTED]> > wrote: > > > 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. > > > >