[SciPy-User] ImportError exits with code 0 after importing scipy.stats (WTF?!)
Daniel Fortunov
daniel.fortunov at man.com
Tue Nov 6 05:55:09 EST 2012
Hello,
01234567890123456789012345678901234567890123456789012345678901234567890123456789
I've been struggling to track down a most curious behaviour that we're observing
in production, which has the nasty side-effect of causing job to crash and burn,
but silently, so that we don't notice until much later.
I've got it down to the following repro steps, on Windows...
An ImportError causes the process to exit with return code 1 (as expected):
(scipytest) C:>python -c "import donkey"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named donkey
(scipytest) C:>echo %errorlevel%
1
However, if scipy.stats has been imported, that same ImportError causes the
process to exit with return code 0 (most unexpected!):
(scipytest) C:>python -c "import scipy.stats; import donkey"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named donkey
(scipytest) C:>echo %errorlevel%
0
I notice that numpy has a custom PackageLoader in _import_tools, which scipy
makes use of, and I think this might be related, but I'm struggling to get to
the bottom of the issue.
Does anyone have any ideas on what is going on here?
Can anyone reproduce this with the same (or similar) software versions below?
Versions:-
OS: Windows 7 Enterprise (SP1)
Python: 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit (Intel)]
numpy: 1.6.2 (built from source)
scipy: 0.9.0 (built from source)
We are using a rather old version of scipy (0.9.0) and I wanted to get an
"official build" of something newer, but the EPD repository only has scipy 0.8.0
built for Python 2.6 (https://www.enthought.com/repo/epd/eggs/python2.6.html)
Any help is much appreciated.
Thanks in advance,
Daniel Fortunov
More information about the SciPy-User
mailing list