pyGame on a Mac

Hi blenders,

This morning i was trying to get pyGame running on a mac. I had to spend several hours, maybe because i did not find the right post, or maybe because im not too smart. Anyway, i will share what i did to get it working straight ahead so that anybody else can do it much faster.

BTW I’m on blender 2.49 ! this might not apply for blender 2.5
I’m on 10.6 but this should not matter.

  1. Download and install python 2.5 (you have it already but do it, you need it):
    http://pythonmac.org/packages/py25-fat/dmg/python-2.5-macosx.dmg

  2. Download and install pygame:
    http://pygame.org/ftp/pygame-1.9.1release-py2.5-macosx10.5.zip

  3. go to your pygame folder and copy it to your blender scripts folder.
    • Your pygame folder is hidden here:
    /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages
    • Your blender scripts folder might be hidden somewhere like here:
    /Applications/blender-2.49b-OSX-10.5-py2.5intel/blender.app/Contents/MacOS/.blender/scripts
    (remember to right click and “show package contents” to navigate inside an app)

  4. Put a sound file (.ogg) next to your blender file.

  5. Once this is done you should b able to run pygame… try something like this:


import pygame.mixer                                           
import os

pygame.mixer.init()                                              
pygame.mixer.music.load("YOUR_SOUND_FILE.ogg")    
pygame.mixer.music.play()

if you don’t know where to put this script and how to use it look for a tutorial like this one:
http://sites.google.com/site/bartiuscrouch02/install

This should work!

I would like to ask if blender 2.5 has improved somehow the sound in GE… i did not find anything related so i assume today we still have to look into pygame to use some features for audio.

Thanks for this forum!
j

well done!

I think you can add the pygame folder to the module search path by enhancing PYTHONPATH.
See http://docs.python.org/tutorial/modules.html.
So you do not need to copy that folder around.