'Python: Cannot import 'AudioFormat'

I am working on an experimental script that was provided by a colleague. After I activated the project, I tried running the script and received the following error:

Traceback (most recent call last):
  File "C:\Users\Lab User\Desktop\Experiments\Victoria\Unyte\experiment_unyte.py", line 9, in <module>
    from expyfun import ExperimentController, decimals_to_binary
  File "C:\ProgramData\Anaconda3\envs\Unyte\lib\site-packages\expyfun\__init__.py", line 10, in <module>
    from ._experiment_controller import ExperimentController, wait_secs
  File "C:\ProgramData\Anaconda3\envs\Unyte\lib\site-packages\expyfun\_experiment_controller.py", line 24, in <module>
    from ._sound_controllers import PygletSoundController, SoundPlayer
  File "C:\ProgramData\Anaconda3\envs\Unyte\lib\site-packages\expyfun\_sound_controllers.py", line 19, in <module>
    from pyglet.media import StreamingSource, AudioFormat, AudioData, Player
ImportError: cannot import name 'AudioFormat' from 'pyglet.media' (C:\ProgramData\Anaconda3\envs\Unyte\lib\site-packages\pyglet\media\__init__.py)

Here is the script in question:

import numpy as np
from expyfun import ExperimentController, decimals_to_binary
from expyfun.visual import ProgressBar
from expyfun.io import read_hdf5
import time
import pyperclip

My colleague recommended that I check that pyglet is installed, and it is according to the Python Interpreter, so I am not sure what to try next. Any advice would be greatly appreciated. Please let me know if there is any other information I can provide.

Thanks, Andrew



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source