Wrong exist status for os.system, os.poepen, etc.

Paul Boddie paul at boddie.org.uk
Tue Mar 6 16:51:22 CET 2007

On 6 Mar, 16:39, "Paolo Pantaleo" <paolopanta... at gmail.com> wrote:
> The os.system() (but all the other funciont with similar behavior) reports
> wrong exit status. I can reproduce the bug in the following way

I think you should look at some previous threads related to this
(obtained by searching Google Groups for "os.system exit status

"grabbing return codes from os.system() call"

"please help me understand os.system() result"

"os.system() << 8 ?"

In short, the returned code is actually a combination of two values,
and you need to extract the expected status code by shifting the
result 8 bits to the right. It may actually be more complicated than
that, but the man page for system ("man 3 system") explains this in
more detail.


More information about the Python-list mailing list