#python #ffmpeg #pydub
Вопрос:
Здравствуйте, я сделал этот код для пакетного преобразования файлов .mp3 в .wav. работал нормально, но теперь он говорит об этом. Вот код:
import os
from pydub import AudioSegment
thisdir = os.getcwd()
def mpwav(dpath):
import os
if os.path.isdir(dpath):
entries = [os.path.join(dpath, entry) for entry in os.listdir(dpath)]
subdirs = filter(os.path.isdir, entries)
if all(map(mpwav, subdirs)):
files = filter(os.path.isfile, entries)
audio_files = [f for f in files if f.endswith('.mp3')]
print(audio_files)
if len(audio_files)>=1:
try:
for fil in audio_files:
print(fil)
src = fil
fs = fil.split(".")
c = str(fs[0])
dst = c '.wav'
sound = AudioSegment.from_mp3(src)
sound.export(dst, format="wav")
os.unlink(fil)
except OSError as e:
print(' ERROR:', e)
print("En: " dpath)
return False
return True
else:
return False
return False
else:
return False
for r, d, f in os.walk(thisdir):
for direct in d:
mpwav(direct)
И вот в чем ошибка:
https://i.stack.imgur.com/KYVwT.png