[Numpy-discussion] Changing Fatal error into ImportError?

Fernando Perez fperez.net at gmail.com
Wed Aug 30 17:57:16 EDT 2006


Hi all,

this was mentioned in the past, but I think it fell through the cracks:

Python 2.3.4 (#1, Mar 10 2006, 06:12:09)
[GCC 3.4.5 20051201 (Red Hat 3.4.5-2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> import mwadap
Overwriting info=<function info at 0xb77198b4> from scipy.misc (was
<function info at 0xb7704bc4> from numpy.lib.utils)
RuntimeError: module compiled against version 90909 of C-API but this
version of numpy is 1000002
Fatal Python error: numpy.core.multiarray failed to import... exiting.

I really think that this should raise ImportError, but NOT kill the
python interpreter.  If this happens in the middle of a long-running
interactive session, you'll lose all of your current state/work, where
a simple ImportError would have been enough to tell you that this
particular module needed recompilation.

FatalError should be reserved for situations where the internal state
of the Python VM itself can not realistically be expected to be sane
(corruption, complete memory exhaustion for even internal allocations,
etc.)  But killing the user's session for a failed import is a bit
much, IMHO.

Cheers,

f




More information about the NumPy-Discussion mailing list