I am trying to have python play an audio file for me. I am writing my code in enthought canopy.
import pyglet
sound = pyglet.media.load('song.wav')
sound.play()
pyglet.app.run()
When I run this I get an error: NameError: global name 'EventLoop' is not defined Also, the audio file plays the first note before the program errors.
I have no idea what is going on.
p.s. Do I need the pylab backend to be interactive for pyglet?
OS - osx 10.12.1 pyglet version 1.1.4-3
Traceback
NameError Traceback (most recent call last)
/Users/name/Documents/name/Arduino Projects/python/Audio Testing.py in <module>()
3 sound = pyglet.media.load('s.wav')
4 sound.play()
----> 5 pyglet.app.run()
/Users/name/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/pyglet/app/__init__.pyc in run()
262
263 '''
--> 264 EventLoop().run()
265
266 def exit():
NameError: global name 'EventLoop' is not defined