Pygame problems with BlenderPlayer


I asked this under the resources thread for Pygame so I’m putting it here as well as I need the answer rather urgently as it could wreck my project.
I am developing my latest thang using pygame for sounds. I’m doing this partly because they are supposedly more reliable, but mainly because I want to be able to turn a sound off. Correct me if I’m wrong but in the blender sounds you can not stop a sound once it has started. I want to use 2 - 3 minute wav files that will stop when a player triggers a sensor.
Anyhow, it works fine from Blender. It works fine compiled as an .exe but if I try opening the Blend with BlenderPlayer ( which is my preference as I’m using a Matrox triplehead2go and need to specify 3072x768 screen size) I get no sound and an error

Traceback (most recent call last):
File “initSound”, line 5, in <module>
pygame.error: Couldn’t read from xxx.wav’

The wav file is in the same directory as everything else.
I have tried moving BlenderPlayer into the directory with the game and sounds and still no good:(:(:frowning:

any ideas?
using xp and 246

I see two solutions for this problem:

  1. you can set the desired screen size from game framing setting in the Scene buttons (F10). It is used to set the window size in the blenderplayer.
  2. you should use the new GameLogic.expandPath() function to create absolute path that will be based on the .blend directory, regardless on how you start the game. This also works in the blenderplayer:

pathname = GameLogic.expandPath("//xxx.wav")

Cool - I’ll try the second. Don’t think I can use the first as there is a maximum size to the game screen resolution under game settings (2000 pixels wide I think and I need 3072) which is why I have been using loading the blend with the blenderplayer.

Will give GameLogic.expandPath() a go

Ed+++ a few minutes later…
Yes it works!!! your a star!