Added exception handling for sound playing dependencies
This commit is contained in:
parent
a7a2de1d24
commit
cfc23718ed
|
@ -937,13 +937,19 @@ class MyForm(QtGui.QMainWindow):
|
||||||
if 'linux' in sys.platform:
|
if 'linux' in sys.platform:
|
||||||
# Note: QSound was a nice idea but it didn't work
|
# Note: QSound was a nice idea but it didn't work
|
||||||
if '.mp3' in soundFilename:
|
if '.mp3' in soundFilename:
|
||||||
subprocess.call(["gst123", soundFilename],
|
try:
|
||||||
stdin=subprocess.PIPE,
|
subprocess.call(["gst123", soundFilename],
|
||||||
stdout=subprocess.PIPE)
|
stdin=subprocess.PIPE,
|
||||||
|
stdout=subprocess.PIPE)
|
||||||
|
except:
|
||||||
|
print "WARNING: gst123 must be installed in order to play mp3 sounds"
|
||||||
else:
|
else:
|
||||||
subprocess.call(["aplay", soundFilename],
|
try:
|
||||||
stdin=subprocess.PIPE,
|
subprocess.call(["aplay", soundFilename],
|
||||||
stdout=subprocess.PIPE)
|
stdin=subprocess.PIPE,
|
||||||
|
stdout=subprocess.PIPE)
|
||||||
|
except:
|
||||||
|
print "WARNING: aplay must be installed in order to play WAV sounds"
|
||||||
elif sys.platform[0:3] == 'win':
|
elif sys.platform[0:3] == 'win':
|
||||||
# use winsound on Windows
|
# use winsound on Windows
|
||||||
import winsound
|
import winsound
|
||||||
|
|
Loading…
Reference in New Issue
Block a user