please help me understand os.system() result

Donn Cave donn at u.washington.edu
Tue May 20 12:01:05 EDT 2003


Quoth Duncan Booth <duncan at NOSPAMrcp.co.uk>:
...
| It looks to me as though the documentation is slightly broken at least on 
| Windows systems. It says the return value is in the format specified for 
| wait, but wait is not implemented on Windows systems. It also says that the  
| return value is system dependant (which is true). The line saying it is the 
| same as for wait should qualify that as only being true on Unix systems. On 
| Windows 2k (and I presume NT and XP) the exit code is returned directly.
|
| >>> os.system('''python -c "import sys; sys.exit(23)"''')
| 23

As it is on BeOS, if we're keeping score.  I assume Windows Python's
os.WEXITSTATUS(exit_status) accounts for this difference, so you can
write ``portable'' code this way.

	Donn Cave, donn at u.washington.edu




More information about the Python-list mailing list