# HG changeset patch # User Simon Cross # Date 1282653813 -7200 # Node ID 18ffaaaa27e7751b6ddeadbc97fbef6cc756e360 # Parent 545dee3bd8e949c9073e5f0015936c96d38bae40 Add explicit check for sound file existence (my pygame 1.9 returns a valid sound object even when the path does not exist). diff -r 545dee3bd8e9 -r 18ffaaaa27e7 gamelib/sound.py --- a/gamelib/sound.py Tue Aug 24 14:33:48 2010 +0200 +++ b/gamelib/sound.py Tue Aug 24 14:43:33 2010 +0200 @@ -4,6 +4,8 @@ # a) work around an annoying bugs # b) add some missing functionality (disable_sound) +import os + from albow.resource import _resource_path, dummy_sound sound_cache = {} @@ -14,6 +16,9 @@ path = _resource_path("sounds", names) sound = sound_cache.get(path) if not sound: + if not os.path.isfile(path): + missing_sound("File does not exist", path) + return dummy_sound try: from pygame.mixer import Sound except ImportError, e: