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

[pygame] PyGame Mac OS X 10.6 fail?



So I am running Mac OS X 10.6.1 on a MacBook Air. I can't QUITE get PyGame working. This might be something that changed out from under me, but if so, it also breaks the sample program ants.py in chapter 7 of  BPWPAP

1) I installed Python 2.6.2 from python.org
2) I installed the pygame 1.9.1 for py 2.6 for 10.5 zip:
http://pygame.org/ftp/pygame-1.9.1release-py2.6-macosx10.5.zip
3) I cd to the directory with my game launcher, and run it, and get the following errors:
[airboat:Programming/Pythons/PlantLand.activity] bcbc% python run.py
2009-09-11 13:50:41.219 Python[781:607] Warning once: This application, or a library it uses, is using NSQuickDrawView, which has been deprecated. Apps should cease use of QuickDraw and move to Quartz.
Traceback (most recent call last):
  File "run.py", line 10, in <module>
    world.run(40,True)
  File "/Users/bcbc/Desktop/Programming/Pythons/PlantLand.activity/world.py", line 11, in run
    font = pygame.font.SysFont(default_font, 24)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/pygame/sysfont.py", line 555, in SysFont
    initsysfonts()
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/pygame/sysfont.py", line 522, in initsysfonts
    fonts = initsysfonts_darwin()
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/pygame/sysfont.py", line 422, in initsysfonts_darwin
    _search_osx_font_paths(fonts)
UnboundLocalError: local variable 'fonts' referenced before assignment

Here is the code running up to the error:
def run(framerate,doCrossfade):
pygame.init()
screen = pygame.display.set_mode(DISPLAY_SIZE, 0, 32)
startSurface = pygame.Surface(DISPLAY_SIZE, 0, depth=32)
endSurface = pygame.Surface(DISPLAY_SIZE, 0, depth=32)
default_font = pygame.font.get_default_font()
font = pygame.font.SysFont(default_font, 24)

So it looks like default_font is getting set, but then pygame.font.SysFont(default_font,24) is failing deep inside the works somewhere.

4) just typing "python" produces seemingly correct behavior:
[airboat:Programming/Pythons/PlantLand.activity] bcbc% python
Python 2.6.2 (r262:71600, Apr 16 2009, 09:17:39) 
[GCC 4.0.1 (Apple Computer, Inc. build 5250)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 2+2
4

Thank you as always!