Search code examples
pythonaudiopyglet

Pyglet sound won't load, the ".load" gives an AttributeError but it worked the day before


I was attempting to make a video player using a mix of Tkinter and Pyglet to run the sound. And it worked...for once. I opened up the file today, ran it to see where I'd left off from when I'd finished last night and...

shop = pyglet.load('shop.wav')
AttributeError: module 'pyglet' has no attribute 'load'

And it worked just last night...

So I tried making a file with just the sound test and the same thing happened. I followed the docs exactly.

import pyglet

shop = pyglet.load('shop.wav')
voice = pyglet.Player()
voice.queue(shop)

voice.play()
pyglet.app.run()

it worked just last night

I re-installed Pyglet, no effect.

Does anyone have any idea what's wrong?


Solution

  • A ".wav" file can be loaded by the pyglet.media module width pyglet.media.load:

    shop = pyglet.media.load('shop.wav')
    

    respectively

    from pyglet.media import load
    
    shop = load('shop.wav')