hi, can you try this: import mixer_music
? I'm not near a mac to try it out at the moment, sorry. cheers, On Sat, Dec 13, 2008 at 10:04 AM, James Paige <[email protected]> wrote: > But pygame.mixer.music isn't a module. You can;t ever do that, > regardless of whether or not you are using py2app. Try it. > > darkside:~/src/hamster/stegavorto/musictest james$ python > Python 2.5.2 (r252:60911, Feb 22 2008, 07:57:53) > [GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin > Type "help", "copyright", "credits" or "license" for more information. >>>> import pygame.mixer.music > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > ImportError: No module named music > > I think .music genuinely is a simple attribute of pygame.mixer and not a > module. I don't understand why, but that seems to be the case. > > --- > James Paige > > On Fri, Dec 12, 2008 at 04:53:11PM -0600, Charlie Nolan wrote: >> What I'm saying is that you should try explicitly importing >> pygame.mixer.music *as a module*. It may be that, for whatever >> reason, py2app is assuming it's a simple attribute of pygame.mixer and >> not bundling the module. >> >> Mind you, that's not how it's *supposed* to work, but so far it's the >> only reason I can think of why pygame might work, but >> pygame.mixer.music not. >> >> -FM >> >> On Fri, Dec 12, 2008 at 3:15 PM, James Paige <[email protected]> >> wrote: >> > well, I just said "from pygame.mixer import music" because that is the >> > shortest line I could find to show the problem, but in my actual code I >> > do something more like this: >> > >> > import pygame >> > pygame.init() >> > pygame.mixer.init() >> > pygame.mixer.music.load("song.ogg") >> > >> > And it crashes something like this when run from a py2app bundle >> > >> > Traceback (most recent call last): >> > File >> > "/Users/james/src/hamster/stegavorto/musictest/dist/musictest.app/Contents/Resources/__boot__.py", >> > line 31, in <module> >> > _run('test.py') >> > File >> > "/Users/james/src/hamster/stegavorto/musictest/dist/musictest.app/Contents/Resources/__boot__.py", >> > line 28, in _run >> > execfile(path, globals(), globals()) >> > File >> > "/Users/james/src/hamster/stegavorto/musictest/dist/musictest.app/Contents/Resources/test.py", >> > line 4, in <module> >> > pygame.mixer.music.load("song.ogg") >> > AttributeError: 'module' object has no attribute 'music' >> > >> > --- >> > James Paige >> > >> > On Fri, Dec 12, 2008 at 01:31:46PM -0600, Charlie Nolan wrote: >> >> I haven't had any problems with it. Maybe the from/import construct >> >> is confusing py2app? Try this: >> >> import pygame.mixer.music as music >> >> -FM >> >> >> >> On Fri, Dec 12, 2008 at 12:26 PM, James Paige <[email protected]> >> >> wrote: >> >> > Hey, I was just working on bundling up a game for Mac with py2app, and >> >> > the app always crashes on any use of pygame.mixer.music. I can reproduce >> >> > it with code this simple: >> >> > >> >> > from pygame.mixer import music >> >> > >> >> > This works perfectly when I run it normally, but in a py2app bundle that >> >> > line (or any line that accesses pygame.mixer.music) will crash with an >> >> > AttributeError >> >> > >> >> > Has anybody else seen this? >> >> > >> >> > I am using Mac OS X 10.3 python 2.5.2 pygame 1.8.2 and I have tried both >> >> > py2app 0.3.6 (stable) and py2app 0.4.4 (dev) >> >> > >> >> > --- >> >> > James Paige >> >> > >> >> >> >> >> > >> >> >
