Background:
I have the following code, which should navigate to the mp3files
dir on my mac and then convert all .mp3
files to .wav
files.
Code:
import os
from pydub import AudioSegment
from ffprobe import FFProbe
path = "/Users/my_username/Documents/uc_davis/Homework_Repos/classify-spotify/william/mp3files"
os.chdir(path)
audio_files = os.listdir()
for file in audio_files:
name, ext = os.path.splitext(file)
if ext == ".mp3":
mp3_sound = AudioSegment.from_mp3(file)
mp3_sound.export("{0}.wav".format(name), format="wav")
Issue:
Upon running this code in Jupyter Lab, I get a ImportError: cannot import name 'FFProbe' from 'ffprobe' (/Users/my_username/anaconda3/envs/my_environment_name/lib/python3.7/site-packages/ffprobe/__init__.py)
What I've tried:
I have double-checked that I have the correct dependencies installed and the dir that the ImportError is referencing DOES have the correct files in it.
Does anyone have any suggestions what I am doing wrong?