Python equivalent of shell's '$?'

Andrew McNamara andrewm at object-craft.com.au
Fri May 31 09:11:38 EDT 2002


>I can't quite remember exactly what the problem was (I seem to recall
>that the errno returned was not what the called program returned). This
>was using both open and backticks. It was yet another nail in the coffin
>that is my opinion of perl ;)

You should read the manual page for the wait() system call, because this is
what os.system() is returning. In particular, the returned value is the
exit status of the sub-process shifted left 8 times (or multiplied by 256)
- at least when the process exits of it's own volition - otherwise the
cause of death is encoded. The manual page should explain all.

-- 
Andrew McNamara, Senior Developer, Object Craft
http://www.object-craft.com.au/





More information about the Python-list mailing list