What command should be use when the testing of arguments is failed?

Roger Binns rogerb at rogerbinns.com
Wed Oct 14 23:02:49 EDT 2009


Peng Yu wrote:
> I actually wanted to ask what return code should be returned in this
> case when the arguments are not right. Thank you1

The BSD world attempted to standardize the codes so you may as well use
their definitions.  You can see them in /usr/include/sysexits.h on your
nearest Linux/Unix box (usually).  There is also an equivalent man page:

  http://www.freebsd.org/cgi/man.cgi?query=sysexits&sektion=3

The posix module also defines these constants if known for the platform.

>>> import os
>>> os.EX_USAGE
64

Doesn't help on non-Unix platforms though :-)

Roger




More information about the Python-list mailing list