command = 'echo this>CON'
print('subprocess -> ' + subprocess.check_output(command, shell=True))
print('native -> ' + str(check_output(command)))
try:
    subprocess.check_output('python output.py', shell=True)
except subprocess.CalledProcessError as e:
    print('subproces CalledProcessError.output = ' + e.output)
try:
    check_output('python output.py')
except subprocess.CalledProcessError as e:
    print('native CalledProcessError.output = ' + e.output)
Python: get output from a command line which exits with nonzero exit code