【发布时间】:2018-10-28 07:18:19
【问题描述】:
我想在 python 脚本中使用 metaflac (https://linux.die.net/man/1/metaflac) 命令。
from subprocess import run
flac_files = "/home/fricadelle/Artist - Album (2008)/*.flac"
run(['metaflac', '--add-replay-gain', flac_files])
我明白了
The FLAC file could not be opened. Most likely the file does not exist
或者不可读。
如果我将 shell = True 添加到运行函数中,我会得到:
ERROR: you must specify at least one FLAC file;
metaflac cannot be used as a pipe
那么我做错了什么?谢谢!
PS:当然,该命令在 shell 中可以正常工作:
metaflac --add-replay-gain /home/fricadelle/Artist\ -\ Album \(2008\)/*.flac
【问题讨论】:
-
这是另一个副本。看在上帝的份上,开始关闭重复并停止回答重复,直到奶牛回家……它只会污染 SO。
标签: python python-3.x shell subprocess