commands.getstatusoutput result is not command line exit value!!!

Hari Sekhon hpsekhon at googlemail.com
Mon Oct 2 10:45:12 EDT 2006


I'm running a command like

import commands
result = commands.getstatusoutput('somecommand')
print result[0]
3072


However, this exit code made no sense so I ran it manually from the 
command line in bash on my linux server and it gives the exit code as 
12, not this weird 3072 number.

So I tried os.system('somecommand') in the interactive python shell and 
it too returned the same result for the exit code as the unix shell, 12, 
but re-running the commands.getstatusoutput() with the exact same 
command still gave 3072.


Is commands.getstatusoutput() broken or something?


-h

-- 
Hari Sekhon




More information about the Python-list mailing list