飘香一剑 发表于 2020-3-25 21:28:24

AudioSegment.from_file打开mp3出错

报错
from pydub import AudioSegment
sound = AudioSegment.from_file("E:\scale.mp3",format="mp3")

dlnb526 发表于 2020-3-25 21:28:25

本帖最后由 dlnb526 于 2020-3-25 21:52 编辑

In Windows , to use echo in subprocess, you would need to use shell=True . This is because echo is not a separate executable, but rather a built-in command for the windows command line. Example -
在windows 在子进程中使用echo,需要设置 shell =True,因为 echo 不是单独的命令,而是window CMD 内置的命令

process1 = subprocess.Popen(command1,stdout=subprocess.PIPE,shell=True)

Also, please do note, you should only use shell=True when absolutely necessary (as in this case , to use echo in windows in subprocess).

并且,需要注意,只有在绝对需要的情况下才使用shell=True

找到 subprocess.py脚本,将对应行加上shell=true 参数。
就是最后一行指向的那个文件。


我百度来的,应该适合你的情况~~~

希望对你有所帮助
页: [1]
查看完整版本: AudioSegment.from_file打开mp3出错