stat, output = commands.getstatusoutput('somecommand')
if stat == 0:
    print('Command succeeded, here is the output: %s' % output)
else:
    print('Command failed, here is the output: %s' % output)
Как получить вывод exe в скрипте python?