Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any analogue of EXIT_SUCCESS and EXIT_FAILURE macros in Python 2.7.6

Is there any analogue of EXIT_SUCCESS and EXIT_FAILURE macros in Python 2.7.6? If yes, how can I use it?

like image 285
FrozenHeart Avatar asked Jun 21 '14 06:06

FrozenHeart


People also ask

Which header file defines EXIT_SUCCESS and EXIT_FAILURE?

The value of EXIT_SUCCESS is defined in stdlib. h as 0; the value of EXIT_FAILURE is 8. This function is also available to C applications in a stand-alone Systems Programming C (SPC) Environment.

What does EXIT_FAILURE return?

If the value of status is EXIT_FAILURE , an implementation-defined form of the status unsuccessful termination is returned. Otherwise the status returned is implementation-defined.


1 Answers

Yes, use os.EX_OK. (Unix only)

As the docs say:

Note: The standard way to exit is sys.exit(n).

You can supply an exit code listed—of the EX_ prefix—here, to sys.exit(n).

like image 95
Dair Avatar answered Oct 18 '22 19:10

Dair