How can I play a sound in Python? I tried using playsound
and saying playsound('explosion.mp3')
but I get an error saying that:
raise IOError('Unable to load sound named: ' + sound)
OSError: Unable to load sound named: file:///Users/Tyler/Desktop/Coding/Surround! v1.1/explosion.mp3
Is there a different module that works better for Mac? Or am I doing it wrong?
Most text editors have their own sound modules. It is completely normal for some sound modules to have no effect on the text editor you are using. Try looking up Sound module for [text-editor]
or try finding a sound module in your text editor's built in marketplace.