错误信息所以我必须:的Python subprocess.call与check_output
result = subprocess.check_output(['wine',
os.getcwd()+'/static/sigcheck.exe',
'-a','-i','-q',
self.tmpfile.path()])
但每当我运行此我得到这个错误
CalledProcessError: Command '['wine', '/home/static/sigcheck.exe', '-a', '-i', '-q', '/tmp/tmpxnsN5j']' returned non-zero exit status 1
但是,如果我改变check_output
到call
它工作正常:
Z:\tmp\tmpvOybcm:
Verified: Unsigned
File date: 9:08 AM 10/24/2012
Publisher: Hardcore Computer
Description: Farthest Emitters Converter
Product: Farthest Emitters Converter
Version: 3.2.0
File version: 3.2.0
fixme:mscoree:StrongNameSignatureVerificationEx (L"Z:\\tmp\\tmpvOybcm", 1, 0x33ec13): stub
Strong Name: Unsigned
Original Name: n/a
Internal Name: Farthest Emitters Converter
Copyright: Hardcore Computer 2006
Comments: n/a
任何原因为什么check_output
不起作用?
有没有办法将输出捕获到变量中? –
你可以在'try:'块中使用'check_output'和'除了CalledProcessError:',但通常的方法是使用管道为stdout,stderr创建一个'subprocess.Popen'对象,然后使用它的'communic''方法。 – wim
谢谢!欣赏这一点。 –