gpt4 book ai didi

python - IsADirectoryError : [Errno 21] Is a directory ( in AudioSegment)

转载 作者:太空宇宙 更新时间:2023-11-04 09:49:54 24 4
gpt4 key购买 nike

脚本:

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'

路径 /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")

关于python - IsADirectoryError : [Errno 21] Is a directory ( in AudioSegment),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48199777/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com