Python equivalent of shell's '$?'

Dave Swegen dswegen at software.plasmon.com
Fri May 31 09:35:05 EDT 2002


On Fri, May 31, 2002 at 11:11:38PM +1000, Andrew McNamara wrote:
> >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.

I'm aware of this. I seem to recall placing it in the same category as
those mysterious broken pipe messages I get now and then :) Seriously
though, if people haven't encountered weird errors in python I might
juts give system calls a spin.

Cheers
    Dave





More information about the Python-list mailing list