capturing system exit status

oscartheduck oscartheduck at
Mon Apr 2 02:45:19 CEST 2007

Hi folks,

in a program I'm writing I have several commands I pass to the unix OS
underneath the code.

I want to perform error checking to make sure that the OS commands'
exit gracefully, but I'm not seeing a simple python module to do this.
The closest I can see is system(), as detailed here:, but I can't
formulate a way to use it.

What I want is a simple if statement such that:

if ExitStatusIsBad:
  go on to next code chunk

More information about the Python-list mailing list