IsADirectoryError: [Errno 21] Is a directory ( in AudioSegment)
IsADirectoryError: [Errno 21] Is a directory ( in AudioSegment)
脚本:
from pydub import AudioSegment
sound = AudioSegment.from_mp3("/srv/python/welcome.mp3")
sound.export("/srv/python/test", format="wav")
错误:
IsADirectoryError: [Errno 21] Is a directory: '/srv/python/test'
path /srv/python/test
以写权限退出 (777) 并且 /srv/python/welcome.mp3
也退出
根据您正在使用的方法的 pydub
文档字符串(我强调):
Export an AudioSegment
to a file with given options
out_f
(string): Path to destination audio file
参数应该是一个文件。
您似乎提供了一个 目录 作为参数,因此您可能希望将其更改为类似以下内容:
sound.export("/srv/python/test/actual_file_name.wav", format="wav")
我错了
sound.export("/srv/python/test", format="wav")
行,第一个参数应该是文件而不是文件夹位置
sound.export("/srv/python/test/welcome.wav", format="wav")
脚本:
from pydub import AudioSegment
sound = AudioSegment.from_mp3("/srv/python/welcome.mp3")
sound.export("/srv/python/test", format="wav")
错误:
IsADirectoryError: [Errno 21] Is a directory: '/srv/python/test'
path /srv/python/test
以写权限退出 (777) 并且 /srv/python/welcome.mp3
也退出
根据您正在使用的方法的 pydub
文档字符串(我强调):
Export an
AudioSegment
to a file with given options
out_f
(string): Path to destination audio file
参数应该是一个文件。
您似乎提供了一个 目录 作为参数,因此您可能希望将其更改为类似以下内容:
sound.export("/srv/python/test/actual_file_name.wav", format="wav")
我错了
sound.export("/srv/python/test", format="wav")
行,第一个参数应该是文件而不是文件夹位置
sound.export("/srv/python/test/welcome.wav", format="wav")