Python subprocess.check_output(args)失败,而args通过Windows命令行工作执行确定 [英] Python subprocess.check_output(args) fails, while args executed via Windows command line work OK
本文介绍了Python subprocess.check_output(args)失败,而args通过Windows命令行工作执行确定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
python的一些问题 subprocess.check_output 。
Some problems with python subprocess.check_output.
output = subprocess.check_output(args)
其中我的 args
是:
args = "C:\\DO\\bin\\Config.exe --ChCfg7 --LFE -b1152000 C:\\DO\\PCM\\1.wav C:\\DO\\PCM\\2.wav C:\\DO\\PCM\\3.wav C:\\DO\\PCM\\4.wav C:\\DO\\PCM\\5.wav C:\\DO\\PCM\6.wav --ModeBCast -oC:\\DO\\OUT\\outfile > C:\\DO\\OUT\\log.txt
这在从标准Windows命令行执行时起作用,但通过Python执行时不起作用 subprocess.check_output
This works when executed from standard windows command line, but doesn't work when executed via Python subprocess.check_output
. In win cmd case there is output file produced and log.txt too, and python script produces out file with size 0, and no log.txt at all.
推荐答案
output = subprocess.check_output(args,shell=True)
使用 shell = True
运行此操作
这篇关于Python subprocess.check_output(args)失败,而args通过Windows命令行工作执行确定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文