Fix for exception due to missing buzzer.wav

This commit is contained in:
daniel-123 2013-01-07 21:26:48 +01:00
parent cbdf10075e
commit 38669acc44

View File

@ -15,6 +15,8 @@ def doBuzz():
winsound.PlaySound(buzzPath, winsound.SND_FILENAME|winsound.SND_ASYNC) winsound.PlaySound(buzzPath, winsound.SND_FILENAME|winsound.SND_ASYNC)
elif(alsaaudio): elif(alsaaudio):
buzzPath = utils.findWorkingDir() + "/resources/buzzer.wav" buzzPath = utils.findWorkingDir() + "/resources/buzzer.wav"
print buzzPath
try:
buzz = wave.open(buzzPath, 'rb') buzz = wave.open(buzzPath, 'rb')
device = alsaaudio.PCM(0) device = alsaaudio.PCM(0)
device.setchannels(buzz.getnchannels()) device.setchannels(buzz.getnchannels())
@ -31,5 +33,6 @@ def doBuzz():
device.write(data) device.write(data)
data = buzz.readframes(640) data = buzz.readframes(640)
buzz.close() buzz.close()
except IOError:
pass