Strange return value from os.system(...) call

Andrew McNamara andrewm at
Wed Oct 13 06:05:07 CEST 2004

>I have a shell script that exits out with either a 0 or 1...and am 
>experiencing a strange phenomenon...
>print "somevalue:"+str(somevalue)
>If my script exits with 0, somevalue is 0
>...if it exits with 1, somevalue is 256

You probably want to read:

You'll want to use something like:

    if os.WIFEXITED(status):
        print 'exited with status %d' % os.WEXITSTATUS(status)

Andrew McNamara, Senior Developer, Object Craft

More information about the Python-list mailing list