[CentralOH] Standard Names for Argument Values to sys.exit(): os.EX_* Does Not Suffice

jep200404 at columbus.rr.com jep200404 at columbus.rr.com
Thu Jul 21 18:06:34 CEST 2011


On Thu, 21 Jul 2011 10:48:40 -0400, jep200404 at columbus.rr.com wrote:

> Does Python (2.6) define standard argument values for sys.exit()? 
> If so, what are they? 
> 
> For portability, I am used to using EXIT_SUCCESS and EXIT_FAILURE 
> in C, because not all operating systems define success as 0 and 
> failure as non-zero. I have been STFW for the Python versions of 
> EXIT_SUCCESS and EXIT_FAILURE, but am getting the idea that Python 
> does not have such. 

I'm still looking. 

I found os.EX_OK, but it does not suffice. 
There does not seem to be an equivalent for EXIT_SUCCESS. 
os.EX_* seem to be for return values of other calls. 
(That it is in os, not sys, should be a clue)

import os
for s in dir(os):
    if s[:3] == 'EX_':
        print s, os[s]

dir(sys) and dir(sys.exit) do not reveal much. 

> By the way, my attempts to connect to http://docs.python.org are 
> being refused. Are others having the same difficulty? 

On Thu, 21 Jul 2011 11:46:45 -0400, Bryan Harris <brywilharris at gmail.com> wrote:

> I am able to access that site right now.

Me too. It's back. 

Thanks to issackelly on #cohpy IRC channel, for his tip about a 
Python doc mirror: http://readthedocs.org/docs/python/en/



More information about the CentralOH mailing list