带有check_output的Python subprocess.call错误消息

Stu*_*Cat 0 python subprocess

所以我有:

result = subprocess.check_output(['wine',
                    os.getcwd()+'/static/sigcheck.exe',
                    '-a','-i','-q',
                    self.tmpfile.path()])
Run Code Online (Sandbox Code Playgroud)

但每当我运行这个我得到这个错误

CalledProcessError: Command '['wine', '/home/static/sigcheck.exe', '-a', '-i', '-q',     '/tmp/tmpxnsN5j']' returned non-zero exit status 1
Run Code Online (Sandbox Code Playgroud)

但如果我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
Run Code Online (Sandbox Code Playgroud)

有什么理由check_output不起作用?

wim*_*wim 6

非零返回码(通常)是指示程序错误退出的方式.因此,subprocess.check_output如果进程的返回码非零,则会引发异常.如果您使用:

retcode = call(...)

然后打印返回代码我猜你会看到它返回1.