Under Windows, executing the following Python script I get an ERRORLEVEL of 0 instead of the expected 2.
import sys
import scipy.io
sys.exit(2)
If I remove the import scipy.io, I got the correct ERRORLEVEL of 2…
Any idea why importing scipy.io cause such an issue?
PS: windows 7, python 2.72, scipy 0.10.1
Calling help(sys.exit) just before the sys.exit call return the following (which seems to be good):
Help on built-in function exit in module sys:
exit(...)
exit([status])
Exit the interpreter by raising SystemExit(status).
If the status is omitted or None, it defaults to zero (i.e., success).
If the status is numeric, it will be used as the system exit status.
If it is another kind of object, it will be printed and the system
exit status will be one (i.e., failure).
If I call
sys.exit('Something wrong')
The string is printed but the system still return 0 as ERRORLEVEL instead of the 1 expected.
This appears to be due to a bug in SciPy. Here are some relevant tickets (only the first one is still open):
One curious observation there is that
Perhaps try importing
scipy.weaveto see if this workaround helps?