[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

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 <brian@xxxxxxxxxxxxxxxxxxx> 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 <musenik@xxxxxxxxx> 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,
> 
=== message truncated ===