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

Re: [pygame] pygame.mixer.music broken in py2app games?



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 <Bob@xxxxxxxxxxxxxxxxxxx> 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
> >
> 
>