The cython_freeze-generated executable exits with code 1 if something
wrong happens, unless a SystemExit exception occurred, in which case it
returns the value passed to sys.exit(). In order to differentiate
between the two cases, change the two example Cython modules to exit(2).
import sys
if len(sys.argv) != 2:
sys.stderr.write("USAGE: %s n\nPrints n!.\n" % sys.argv[0])
- sys.exit(1)
+ sys.exit(2)
n, = map(float, sys.argv[1:])
print factorial(n)
import sys
if len(sys.argv) != 3:
sys.stderr.write("USAGE: %s n r\nPrints n-choose-r.\n" % sys.argv[0])
- sys.exit(1)
+ sys.exit(2)
n, r = map(float, sys.argv[1:])
print nCr(n, r)