Python: get output from a command line which exits with nonzero exit code
问题 I am Using Python 2.7.1 on a Windows Server 2008 R2 x64 box. I'm trying to get the output of a command line process which gives a nonzero exit status after outputting the information I need. I was initially using subprocess.check_output , and catching the CalledProcessError which occurs with nonzero exit status, but while the returncode was stored in the error, no output revealed this. Running this against cases which give output but have an exit status of 0 works properly and I can get the